<html>
<head><meta charset="utf-8"><title>object upcasting · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html">object upcasting</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="162835989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162835989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162835989">(Apr 08 2019 at 17:09)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> -- I was thinking more about <code>dyn Trait</code> upcasting while I was away. Not sure if you are still looking for a "next task", but I think that is what we should consider. It is basically a real pain that we cannot do it =)</p>



<a name="162836120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836120">(Apr 08 2019 at 17:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Yep! I've had nothing serious on my plate for about a week now (mainly waiting on feedback), so that sounds cool.</p>



<a name="162836150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836150">(Apr 08 2019 at 17:10)</a>:</h4>
<p>I also don't think it's all <strong>that</strong> complex a problem.</p>



<a name="162836161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836161">(Apr 08 2019 at 17:10)</a>:</h4>
<p>I guess the way to start would be by doing some review of how the current setup works etc</p>



<a name="162836176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836176">(Apr 08 2019 at 17:10)</a>:</h4>
<p>(TBH, I wonder if it's worth making this a working group of its own)</p>



<a name="162836184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836184">(Apr 08 2019 at 17:11)</a>:</h4>
<p>maybe, maybe not</p>



<a name="162836201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836201">(Apr 08 2019 at 17:11)</a>:</h4>
<p>had a question for you about a) maybe bounds in trait objects, b) RPIT existential lifetimes (can wait a bit maybe)</p>



<a name="162836213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836213">(Apr 08 2019 at 17:11)</a>:</h4>
<p>yeah... not sure, honestly. I'm up for it if you are though.</p>



<a name="162836229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836229">(Apr 08 2019 at 17:11)</a>:</h4>
<p>shall we start a HackMD doc at least?</p>



<a name="162836235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836235">(Apr 08 2019 at 17:11)</a>:</h4>
<p>or similar</p>



<a name="162836545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836545">(Apr 08 2019 at 17:15)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ^</p>



<a name="162836742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836742">(Apr 08 2019 at 17:17)</a>:</h4>
<blockquote>
<p>shall we start a HackMD doc at least?</p>
</blockquote>
<p>start a doc for upcasting?</p>



<a name="162836747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836747">(Apr 08 2019 at 17:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah</p>



<a name="162836755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836755">(Apr 08 2019 at 17:17)</a>:</h4>
<p>seems reasonable</p>



<a name="162836760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836760">(Apr 08 2019 at 17:17)</a>:</h4>
<p>there is a bit of prior work we can research in terms of vtable layout,</p>



<a name="162836761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836761">(Apr 08 2019 at 17:17)</a>:</h4>
<p>we can summarise the current state</p>



<a name="162836813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836813">(Apr 08 2019 at 17:18)</a>:</h4>
<p>then part B can be an action plan</p>



<a name="162836814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836814">(Apr 08 2019 at 17:18)</a>:</h4>
<p>but I think ultimately it's not <em>that</em> important what we settle on here</p>



<a name="162836820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836820">(Apr 08 2019 at 17:18)</a>:</h4>
<p>sure</p>



<a name="162836826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836826">(Apr 08 2019 at 17:18)</a>:</h4>
<p>(as long as we leave room for us to change later)</p>



<a name="162836847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836847">(Apr 08 2019 at 17:18)</a>:</h4>
<p>what we probably want to do is to try and schedule a time to draw up an action plan with first few steps</p>



<a name="162836854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836854">(Apr 08 2019 at 17:18)</a>:</h4>
<p>maybe we can get <span class="user-mention" data-user-id="119009">@eddyb</span> involved</p>



<a name="162836887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836887">(Apr 08 2019 at 17:19)</a>:</h4>
<p>yeah that would be good, if he's free</p>



<a name="162836912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836912">(Apr 08 2019 at 17:19)</a>:</h4>
<p>okay, we have a Zoom meeting to kick things off... got any suggestions for when?</p>



<a name="162836975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162836975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162836975">(Apr 08 2019 at 17:20)</a>:</h4>
<p>tomorrow is difficult for me, but other than that, afternoons should be fine...</p>



<a name="162839491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162839491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162839491">(Apr 08 2019 at 17:49)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> can you make a doodle with some options that work for you?</p>



<a name="162860031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162860031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162860031">(Apr 08 2019 at 22:16)</a>:</h4>
<p>Sure, here it is: <a href="https://doodle.com/poll/7xdsf8rcy4g989v7" target="_blank" title="https://doodle.com/poll/7xdsf8rcy4g989v7">https://doodle.com/poll/7xdsf8rcy4g989v7</a> <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="162860054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162860054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162860054">(Apr 08 2019 at 22:16)</a>:</h4>
<p>CC <span class="user-mention" data-user-id="131912">@dhardy</span> <span class="user-mention" data-user-id="210316">@Guillaume</span> (people whom I know have interest in this)</p>



<a name="162885682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162885682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162885682">(Apr 09 2019 at 06:47)</a>:</h4>
<p>Here I am!</p>



<a name="162914440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162914440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162914440">(Apr 09 2019 at 14:19)</a>:</h4>
<p><span class="user-mention" data-user-id="210316">@Guillaume</span> Cool, thanks for the response. Hopefully we'll figure out when Niko and maybe others can make it too.</p>



<a name="162914460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162914460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162914460">(Apr 09 2019 at 14:19)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  Do you want to participate too? :-)</p>



<a name="162950539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162950539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162950539">(Apr 09 2019 at 21:11)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ok I filled it out</p>



<a name="162950658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162950658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162950658">(Apr 09 2019 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> cheers. we'll go with Fri at 6:00 then probably...</p>



<a name="162950670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162950670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162950670">(Apr 09 2019 at 21:12)</a>:</h4>
<p>unless someone else replies soon</p>



<a name="162950680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162950680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162950680">(Apr 09 2019 at 21:12)</a>:</h4>
<p>sorry if time zone was confusing</p>



<a name="162953431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162953431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162953431">(Apr 09 2019 at 21:55)</a>:</h4>
<p><a href="https://calendar.google.com/event?action=TEMPLATE&amp;tmeid=NGY2Y250ZWsxdnVmdGdqZjRyM2c0ZGppZGEgNnU1cnJ0Y2U2bHJ0djA3cGZpM2RhbWdqdXNAZw&amp;tmsrc=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com" target="_blank" title="https://calendar.google.com/event?action=TEMPLATE&amp;tmeid=NGY2Y250ZWsxdnVmdGdqZjRyM2c0ZGppZGEgNnU1cnJ0Y2U2bHJ0djA3cGZpM2RhbWdqdXNAZw&amp;tmsrc=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com">Created a calendar event</a>, which includes a zoom link</p>



<a name="162953436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162953436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162953436">(Apr 09 2019 at 21:55)</a>:</h4>
<p>(Or did we want to do this on Zulip?)</p>



<a name="162953585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162953585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162953585">(Apr 09 2019 at 21:57)</a>:</h4>
<p>Either is fine. What do you think's more efficient? Incidentally, I put 1 hour duration in Doodle, but if you think we only need 45 mins, then that's cool.</p>



<a name="162953599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162953599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162953599">(Apr 09 2019 at 21:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> could we get your feedback on <a href="https://github.com/rust-lang/rust/issues/59656" target="_blank" title="https://github.com/rust-lang/rust/issues/59656">https://github.com/rust-lang/rust/issues/59656</a> at some point soon btw? :-)</p>



<a name="162953712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162953712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162953712">(Apr 09 2019 at 21:58)</a>:</h4>
<blockquote>
<p><a href="https://calendar.google.com/event?action=TEMPLATE&amp;tmeid=NGY2Y250ZWsxdnVmdGdqZjRyM2c0ZGppZGEgNnU1cnJ0Y2U2bHJ0djA3cGZpM2RhbWdqdXNAZw&amp;tmsrc=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com" target="_blank" title="https://calendar.google.com/event?action=TEMPLATE&amp;tmeid=NGY2Y250ZWsxdnVmdGdqZjRyM2c0ZGppZGEgNnU1cnJ0Y2U2bHJ0djA3cGZpM2RhbWdqdXNAZw&amp;tmsrc=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com">Created a calendar event</a>, which includes a zoom link</p>
</blockquote>
<p>CC <span class="user-mention" data-user-id="210316">@Guillaume</span></p>



<a name="162962433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162962433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162962433">(Apr 10 2019 at 00:22)</a>:</h4>
<p>I might attend; can you add the calendar link to t-compiler's calendar? or t-lang's</p>



<a name="162987628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/162987628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#162987628">(Apr 10 2019 at 09:18)</a>:</h4>
<p>it <em>is</em> on the compiler calendar. Though your comment confused me :P and I might have messed up the link just now, if so, <a href="https://calendar.google.com/event?action=TEMPLATE&amp;tmeid=NGY2Y250ZWsxdnVmdGdqZjRyM2c0ZGppZGEgNnU1cnJ0Y2U2bHJ0djA3cGZpM2RhbWdqdXNAZw&amp;tmsrc=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com" target="_blank" title="https://calendar.google.com/event?action=TEMPLATE&amp;tmeid=NGY2Y250ZWsxdnVmdGdqZjRyM2c0ZGppZGEgNnU1cnJ0Y2U2bHJ0djA3cGZpM2RhbWdqdXNAZw&amp;tmsrc=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com">here is another one</a>.</p>



<a name="163009451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163009451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163009451">(Apr 10 2019 at 14:30)</a>:</h4>
<p>oh; I might have looked at the wrong week :P</p>



<a name="163013494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163013494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163013494">(Apr 10 2019 at 15:11)</a>:</h4>
<p>it's this week :-P</p>



<a name="163014648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163014648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163014648">(Apr 10 2019 at 15:23)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span>  yeah I looked 1 week into the future</p>



<a name="163014656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163014656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163014656">(Apr 10 2019 at 15:23)</a>:</h4>
<p>heh okay</p>



<a name="163029831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163029831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163029831">(Apr 10 2019 at 18:08)</a>:</h4>
<p>I should be able to attend. I added the event to my calendar. :)</p>



<a name="163202921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163202921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163202921">(Apr 12 2019 at 15:56)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> (cc <span class="user-mention" data-user-id="210316">@Guillaume</span>, <span class="user-mention" data-user-id="126931">@centril</span>, <span class="user-mention" data-user-id="119009">@eddyb</span>, whomever else) -- I had made this a Zoom meeting, but I was wondering if we really want that? I've found Zulip often works as well or better. I'm inclined probably to do it over Zulip myself.</p>



<a name="163202938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163202938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163202938">(Apr 12 2019 at 15:57)</a>:</h4>
<p>(To be clear, it doesn't start for a few hours, I just wanted to check because -- if so -- I'll edit the event)</p>



<a name="163203201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203201">(Apr 12 2019 at 16:00)</a>:</h4>
<p>Zulip is fine with me too, yeah</p>



<a name="163203207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203207">(Apr 12 2019 at 16:00)</a>:</h4>
<p>The time was set for now, I thought, <span class="user-mention" data-user-id="116009">@nikomatsakis</span>...</p>



<a name="163203429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203429">(Apr 12 2019 at 16:03)</a>:</h4>
<p>at least that's what's in the calendar</p>



<a name="163203640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203640">(Apr 12 2019 at 16:06)</a>:</h4>
<p>the calendar says in 1 hr?</p>



<a name="163203658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203658">(Apr 12 2019 at 16:07)</a>:</h4>
<p>hmm, not for me</p>



<a name="163203659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203659">(Apr 12 2019 at 16:07)</a>:</h4>
<p>weird</p>



<a name="163203664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203664">(Apr 12 2019 at 16:07)</a>:</h4>
<p>anyway, 1hr is fine</p>



<a name="163203667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203667">(Apr 12 2019 at 16:07)</a>:</h4>
<p>no worries</p>



<a name="163203681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163203681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163203681">(Apr 12 2019 at 16:07)</a>:</h4>
<p>maybe iCal confused the timezones</p>



<a name="163204466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163204466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163204466">(Apr 12 2019 at 16:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> in the meanwhile, did you see the GitHub issue about maybe bounds in trait objects?</p>



<a name="163204503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163204503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163204503">(Apr 12 2019 at 16:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> it's part of the PR I made for enforcing single-trait objects with trait aliases. I did some other things like removed the concept of principal traits, which arielby never got around to finishing.</p>



<a name="163204512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163204512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163204512">(Apr 12 2019 at 16:19)</a>:</h4>
<p>this is the last remaining thing...</p>



<a name="163205956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163205956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163205956">(Apr 12 2019 at 16:39)</a>:</h4>
<p>for me it's in 21 min</p>



<a name="163206420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163206420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163206420">(Apr 12 2019 at 16:46)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I would prefer Zoom; I find that you often get more done via audio since you don't have to think and type :P</p>



<a name="163206698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163206698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163206698">(Apr 12 2019 at 16:50)</a>:</h4>
<p>Let's do Zulip though, sorry Centril. Niko is leading this meeting so if he slightly prefers that it's probably best... I slightly prefer it too.</p>



<a name="163206735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163206735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163206735">(Apr 12 2019 at 16:50)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> in the meanwhile, did you see the GitHub issue about maybe bounds in trait objects?</p>
</blockquote>
<p>I did not</p>



<a name="163206764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163206764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163206764">(Apr 12 2019 at 16:51)</a>:</h4>
<p>Link?</p>



<a name="163206772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163206772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163206772">(Apr 12 2019 at 16:51)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/59656" target="_blank" title="https://github.com/rust-lang/rust/issues/59656">https://github.com/rust-lang/rust/issues/59656</a></p>



<a name="163207001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207001">(Apr 12 2019 at 16:55)</a>:</h4>
<p>@centril thanks</p>



<a name="163207370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207370">(Apr 12 2019 at 16:59)</a>:</h4>
<p>Should we start?</p>



<a name="163207521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207521">(Apr 12 2019 at 17:01)</a>:</h4>
<p>Yep, let's start</p>



<a name="163207541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207541">(Apr 12 2019 at 17:01)</a>:</h4>
<p>Hey <span class="user-group-mention" data-user-group-id="692">@WG-traits</span> -- we're going to talk about trait upcasting (cc <span class="user-mention" data-user-id="119009">@eddyb</span> if you're around and interested)</p>



<a name="163207556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207556">(Apr 12 2019 at 17:02)</a>:</h4>
<p>First, to set the stage</p>



<a name="163207593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207593">(Apr 12 2019 at 17:02)</a>:</h4>
<p>Let me clarify what <em>I</em> think we're talking about :)</p>



<a name="163207594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207594">(Apr 12 2019 at 17:02)</a>:</h4>
<p>yep...</p>



<a name="163207595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207595">(Apr 12 2019 at 17:02)</a>:</h4>
<p>Or perhaps what we're <em>not</em> talking about</p>



<a name="163207604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207604">(Apr 12 2019 at 17:02)</a>:</h4>
<p>I think we are not talking about supporting <code>dyn Foo + Bar</code> for arbitrary <code>Foo</code> and <code>Bar</code></p>



<a name="163207628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207628">(Apr 12 2019 at 17:02)</a>:</h4>
<p>That is, the definition of a trait object type as <code>dyn Principal + AutoTraits</code> would not be altered</p>



<a name="163207637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207637">(Apr 12 2019 at 17:02)</a>:</h4>
<p>But we <em>would</em> permit upcasting to supertraits via a coercion</p>



<a name="163207655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207655">(Apr 12 2019 at 17:03)</a>:</h4>
<p>so e.g. if you had <code>trait Foo: Bar + Baz</code>, then <code>dyn Foo</code> could be coerced to <code>dyn Bar</code> or <code>dyn Baz</code></p>



<a name="163207660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207660">(Apr 12 2019 at 17:03)</a>:</h4>
<p>if we later add support for <code>dyn Bar + Baz</code>, of course we would want to permit coercion to that too</p>



<a name="163207677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207677">(Apr 12 2019 at 17:03)</a>:</h4>
<p>or perhaps I should say <em>when</em></p>



<a name="163207682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207682">(Apr 12 2019 at 17:03)</a>:</h4>
<p>since I am assuming we will do so at some point</p>



<a name="163207688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207688">(Apr 12 2019 at 17:03)</a>:</h4>
<p>but I think that's a more complex topic</p>



<a name="163207704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207704">(Apr 12 2019 at 17:03)</a>:</h4>
<p>Does everybody agree with this so far? :)</p>



<a name="163207764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207764">(Apr 12 2019 at 17:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> don't we permit <code>dyn Principal + Auto</code> ~&gt; <code>dyn Principal</code> today?</p>



<a name="163207781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207781">(Apr 12 2019 at 17:04)</a>:</h4>
<p>We may, I forget.</p>



<a name="163207786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207786">(Apr 12 2019 at 17:04)</a>:</h4>
<p>Good to clarify.</p>



<a name="163207806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207806">(Apr 12 2019 at 17:04)</a>:</h4>
<p>Also, if we do, if we do it via coercion or subtyping (internally to the compiler).</p>



<a name="163207828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207828">(Apr 12 2019 at 17:05)</a>:</h4>
<p>(and maybe <code>dyn Principal + Auto</code> ~&gt; <code>dyn Auto</code> but I don't think we allow just auto traits...)</p>



<a name="163207929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207929">(Apr 12 2019 at 17:06)</a>:</h4>
<p>this <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=0f4e4f7a9a9d75a86faad5e47aa3b0c4" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=0f4e4f7a9a9d75a86faad5e47aa3b0c4">builds</a>:</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">coerce</span><span class="p">(</span><span class="n">x</span>: <span class="kp">&amp;</span><span class="p">(</span><span class="n">dyn</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">Send</span><span class="p">))</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span>: <span class="kp">&amp;</span><span class="nc">dyn</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">x</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="c1">// let _: &amp;dyn Send = x;</span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="163207939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207939">(Apr 12 2019 at 17:06)</a>:</h4>
<p>but the commented line does not</p>



<a name="163207981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207981">(Apr 12 2019 at 17:07)</a>:</h4>
<p>you get this:</p>
<div class="codehilite"><pre><span></span>Standard Error

   Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
 --&gt; src/main.rs:5:24
  |
5 |     let _: &amp;dyn Send = x;
  |                        ^ expected trait `std::marker::Send`, found trait `Foo + std::marker::Send`
  |
  = note: expected type `&amp;dyn std::marker::Send`
             found type `&amp;dyn Foo + std::marker::Send`
</pre></div>



<a name="163207982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207982">(Apr 12 2019 at 17:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Yep I agree.</p>



<a name="163207994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163207994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163207994">(Apr 12 2019 at 17:07)</a>:</h4>
<p>I suspect this is because we have "broken-ish" code doing that coercion</p>



<a name="163208003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208003">(Apr 12 2019 at 17:07)</a>:</h4>
<p>multi-trait objects can come later. it's a natural progression, but this is the natural first step.</p>



<a name="163208007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208007">(Apr 12 2019 at 17:07)</a>:</h4>
<p>I see</p>



<a name="163208011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208011">(Apr 12 2019 at 17:07)</a>:</h4>
<p>basically I suspect we permit reducing the set of auto traits, but not changing the principal (in this case, from something to nothing)</p>



<a name="163208015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208015">(Apr 12 2019 at 17:07)</a>:</h4>
<p>but let's find the actual code</p>



<a name="163208071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208071">(Apr 12 2019 at 17:08)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I wonder if the PR you just looked at happens to fix that... since it removes principals as a concept ;-)</p>



<a name="163208085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208085">(Apr 12 2019 at 17:08)</a>:</h4>
<p>I could test now actually heh</p>



<a name="163208112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208112">(Apr 12 2019 at 17:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> another thing: type constructors seem relevant here, because I assume were are not going to allow <code>F&lt;dyn Sub&gt;</code> ~&gt; <code>F&lt;dyn Super&gt;</code> for arbitrary <code>F</code> -- but still we do want to allow <code>Box&lt;dyn Sub&gt;</code> ~&gt; <code>Box&lt;dyn Super&gt;</code></p>



<a name="163208135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208135">(Apr 12 2019 at 17:09)</a>:</h4>
<p>IOW, <code>dyn Sub &lt;: dyn Super</code> does not hold</p>



<a name="163208158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208158">(Apr 12 2019 at 17:09)</a>:</h4>
<p>ah nope, same error in the build for that PR</p>



<a name="163208217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208217">(Apr 12 2019 at 17:10)</a>:</h4>
<blockquote>
<p>but let's find the actual code</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/blob/5b96425699476ccfc4c56185067d80cb792044a3/src/librustc/ty/relate.rs#L576-L599" target="_blank" title="https://github.com/rust-lang/rust/blob/5b96425699476ccfc4c56185067d80cb792044a3/src/librustc/ty/relate.rs#L576-L599">this is the subtyping code for trait objects</a>, unless I'm confused it seems to require an exact match, so this is presumably a coercion</p>



<a name="163208259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208259">(Apr 12 2019 at 17:11)</a>:</h4>
<p>Yes, the <a href="https://github.com/rust-lang/rust/blob/master/src/librustc/traits/select.rs#L2169-L2186" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc/traits/select.rs#L2169-L2186">coercion is here</a>, and it says:</p>



<a name="163208274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208274">(Apr 12 2019 at 17:11)</a>:</h4>
<div class="codehilite"><pre><span></span> // Upcasts permit two things:
                //
                // 1. Dropping builtin bounds, e.g., `Foo+Send` to `Foo`
                // 2. Tightening the region bound, e.g., `Foo+&#39;a` to `Foo+&#39;b` if `&#39;a : &#39;b`
                //
                // Note that neither of these changes requires any
                // change at runtime.  Eventually this will be
                // generalized.
                //
                // We always upcast when we can because of reason
// #2 (region bounds).
</pre></div>



<a name="163208300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208300">(Apr 12 2019 at 17:11)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> another thing: type constructors seem relevant here, because I assume were are not going to allow <code>F&lt;dyn Sub&gt;</code> ~&gt; <code>F&lt;dyn Super&gt;</code> for arbitrary <code>F</code> -- but still we do want to allow <code>Box&lt;dyn Sub&gt;</code> ~&gt; <code>Box&lt;dyn Super&gt;</code></p>
</blockquote>
<p>this should just fall out from the unsizing rules, <span class="user-mention" data-user-id="126931">@centril</span></p>



<a name="163208304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208304">(Apr 12 2019 at 17:11)</a>:</h4>
<p>Yeah that seems reasonable</p>



<a name="163208365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208365">(Apr 12 2019 at 17:12)</a>:</h4>
<blockquote>
<p>this should just fall out from the unsizing rules, <span class="user-mention silent" data-user-id="126931">centril</span> </p>
</blockquote>
<p>Also reasonable <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="163208393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208393">(Apr 12 2019 at 17:12)</a>:</h4>
<p>basically, any place that we would permit the <em>existing upcast</em> (which is tied to unsizing), we would also permit the trait object upcast</p>



<a name="163208400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208400">(Apr 12 2019 at 17:12)</a>:</h4>
<p>the key point is that doing this upcast may change the vtable</p>



<a name="163208413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208413">(Apr 12 2019 at 17:12)</a>:</h4>
<p>so it is definitely not <em>subtyping</em> in the compiler's sense of the word</p>



<a name="163208430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208430">(Apr 12 2019 at 17:12)</a>:</h4>
<p>so maybe we turn to that for a second, that is, how I would expect to implement</p>



<a name="163208460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208460">(Apr 12 2019 at 17:13)</a>:</h4>
<p>my expectation is that we will basically have the vtable for a given trait</p>



<a name="163208466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208466">(Apr 12 2019 at 17:13)</a>:</h4>
<p>include pointers to the vtables for its supertraits</p>



<a name="163208476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208476">(Apr 12 2019 at 17:13)</a>:</h4>
<p>we know that, at least presently, the vtables are structured in a tree</p>



<a name="163208483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208483">(Apr 12 2019 at 17:13)</a>:</h4>
<p>er, sorry, supertrait relations are structured in a tree</p>



<a name="163208486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208486">(Apr 12 2019 at 17:13)</a>:</h4>
<p>I'd actually like to lift that restriction</p>



<a name="163208536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208536">(Apr 12 2019 at 17:14)</a>:</h4>
<p>but that seems separable (though maybe worth thinking through how it would work at runtime)</p>



<a name="163208544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208544">(Apr 12 2019 at 17:14)</a>:</h4>
<p>(btw, do we have an RFC for upcasting?)</p>



<a name="163208548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208548">(Apr 12 2019 at 17:14)</a>:</h4>
<p>not that I know of</p>



<a name="163208558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208558">(Apr 12 2019 at 17:14)</a>:</h4>
<p>I was going to bring up the question of what procedure to follow</p>



<a name="163208562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208562">(Apr 12 2019 at 17:14)</a>:</h4>
<p>it's hard to imagine it being <em>controversial</em></p>



<a name="163208568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208568">(Apr 12 2019 at 17:14)</a>:</h4>
<p>but I think documenting the plan is good</p>



<a name="163208573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208573">(Apr 12 2019 at 17:15)</a>:</h4>
<p>ok, it seems to me that an rfc needs to happen at some point</p>



<a name="163208574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208574">(Apr 12 2019 at 17:15)</a>:</h4>
<p>Is it required to have one? There doesn't seem to have much debates about the feature itself?</p>



<a name="163208596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208596">(Apr 12 2019 at 17:15)</a>:</h4>
<p>I don't think there's debate, but that's not a reason not to have the RFC</p>



<a name="163208600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208600">(Apr 12 2019 at 17:15)</a>:</h4>
<p>put another way, you won't know if there's debate, until you create a forum for it :)</p>



<a name="163208604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208604">(Apr 12 2019 at 17:15)</a>:</h4>
<p>but I would expect us to move to FCP quickly</p>



<a name="163208621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208621">(Apr 12 2019 at 17:15)</a>:</h4>
<p>Fair enough!</p>



<a name="163208622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208622">(Apr 12 2019 at 17:15)</a>:</h4>
<p>it's a good use of the staging mechanism -- the lang design questions are relatively sparse</p>



<a name="163208636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208636">(Apr 12 2019 at 17:16)</a>:</h4>
<p>(it's mostly an impl plan question, and that mostly isn't exposed to users)</p>



<a name="163208682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208682">(Apr 12 2019 at 17:16)</a>:</h4>
<p>but also, the purpose of RFCs is not just debates, it is also for clearly communicating what we are doing, make sure its well thought, and also spread knowledge</p>



<a name="163208685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208685">(Apr 12 2019 at 17:16)</a>:</h4>
<blockquote>
<p>Is it required to have one? There doesn't seem to have much debates about the feature itself?</p>
</blockquote>
<p>still I did wonder the same thing to myself :)</p>



<a name="163208695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208695">(Apr 12 2019 at 17:16)</a>:</h4>
<blockquote>
<p>but also, the purpose of RFCs is not just debates, it is also for clearly communicating what we are doing, make sure its well thought, and also spread knowledge</p>
</blockquote>
<p>yes very much this</p>



<a name="163208718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208718">(Apr 12 2019 at 17:16)</a>:</h4>
<blockquote>
<p>include pointers to the vtables for its supertraits</p>
</blockquote>
<p>there is another impl route</p>



<a name="163208722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208722">(Apr 12 2019 at 17:16)</a>:</h4>
<p>This is another fair point :)</p>



<a name="163208742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208742">(Apr 12 2019 at 17:17)</a>:</h4>
<p>after all the vtable for the trait Foo <em>already</em> contains all the methods for its supertraits</p>



<a name="163208747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208747">(Apr 12 2019 at 17:17)</a>:</h4>
<p>we could lay them out in such a way that</p>



<a name="163208753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208753">(Apr 12 2019 at 17:17)</a>:</h4>
<p>we can compute <em>a</em> vtable for the supertrait by applying an offset to the vtable for <code>Foo</code></p>



<a name="163208765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208765">(Apr 12 2019 at 17:17)</a>:</h4>
<p>there's a whole bunch of literature on this from the C++ space</p>



<a name="163208773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208773">(Apr 12 2019 at 17:17)</a>:</h4>
<p>I actually don't care much at all what we do here, though I think embedding some pointers for supertraits might be easier</p>



<a name="163208825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208825">(Apr 12 2019 at 17:18)</a>:</h4>
<p>(I definitely don't think we should promise any particular layout to users)</p>



<a name="163208826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208826">(Apr 12 2019 at 17:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah, I wonder if that will work better when we come to supporting multi-trait objects and their vtables later</p>



<a name="163208835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208835">(Apr 12 2019 at 17:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> imo, we can also iterate on layout</p>



<a name="163208841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208841">(Apr 12 2019 at 17:18)</a>:</h4>
<p>like, even start with the "dumb" version at first</p>



<a name="163208887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163208887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163208887">(Apr 12 2019 at 17:19)</a>:</h4>
<p>trait object layout is probably also not a wg-traits area of expertise?</p>



<a name="163209001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209001">(Apr 12 2019 at 17:20)</a>:</h4>
<p>I don't know why not</p>



<a name="163209006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209006">(Apr 12 2019 at 17:20)</a>:</h4>
<p>but I wouldn't expect this to ultimately be in wg-traits from compiler POV</p>



<a name="163209014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209014">(Apr 12 2019 at 17:20)</a>:</h4>
<p>I think we should just make a WG for this particular effort</p>



<a name="163209024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209024">(Apr 12 2019 at 17:20)</a>:</h4>
<p>sounds reasonable</p>



<a name="163209043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209043">(Apr 12 2019 at 17:21)</a>:</h4>
<p>wg-subtyping? :-P</p>



<a name="163209049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209049">(Apr 12 2019 at 17:21)</a>:</h4>
<p>wg-coercion ;)</p>



<a name="163209058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209058">(Apr 12 2019 at 17:21)</a>:</h4>
<p>no :) wg-dyn-upcast :)</p>



<a name="163209072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209072">(Apr 12 2019 at 17:21)</a>:</h4>
<p>(by which I mean I think we should be focused)</p>



<a name="163209159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209159">(Apr 12 2019 at 17:22)</a>:</h4>
<p>anyway, i know I checked in with <span class="user-mention" data-user-id="119009">@eddyb</span> earlier and they seemed to agree with everything we've written so far, so that's good =)</p>



<a name="163209164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209164">(Apr 12 2019 at 17:22)</a>:</h4>
<p>Here's an idea: 1) work on the type system logic, 2) work on the layout logic, 3) work on an RFC, 4) iterate on 2., 5) stabilize</p>



<a name="163209169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209169">(Apr 12 2019 at 17:22)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> imo, we can also iterate on layout</p>
</blockquote>
<p>also I meant to say yes to this :) I agree</p>



<a name="163209227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209227">(Apr 12 2019 at 17:23)</a>:</h4>
<p>/me grumbles something about most of the logic being around anyway</p>



<a name="163209251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209251">(Apr 12 2019 at 17:23)</a>:</h4>
<p>you might even be able to separate 1 &amp; 2 completely by producing some well placed ICEs anyways</p>



<a name="163209264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209264">(Apr 12 2019 at 17:23)</a>:</h4>
<p>like, this isn't even that much work, implementation-wise?</p>



<a name="163209265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209265">(Apr 12 2019 at 17:23)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> ok, seems like you'll have a full implementation up in a PR tomorrow then ^^</p>



<a name="163209269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209269">(Apr 12 2019 at 17:23)</a>:</h4>
<p>and hasn't been for ages</p>



<a name="163209279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209279">(Apr 12 2019 at 17:23)</a>:</h4>
<p>my issue is I have to do several things already</p>



<a name="163209286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209286">(Apr 12 2019 at 17:24)</a>:</h4>
<p>if not for that, sure</p>



<a name="163209338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209338">(Apr 12 2019 at 17:24)</a>:</h4>
<p>I want to nominate <span class="user-mention" data-user-id="119009">@eddyb</span> to help mentor <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> =)</p>



<a name="163209353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209353">(Apr 12 2019 at 17:24)</a>:</h4>
<p>the "is supertrait" check is easy, like, copypaste another place that does it already</p>



<a name="163209359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209359">(Apr 12 2019 at 17:24)</a>:</h4>
<p>but I agree it's not all that much work</p>



<a name="163209371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209371">(Apr 12 2019 at 17:24)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> don't worry, Niko planned for me to do it anywya. if you want to mentor me, that's cool though.</p>



<a name="163209374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209374">(Apr 12 2019 at 17:24)</a>:</h4>
<p>and in terms of doing it, we already encode several things like these</p>



<a name="163209378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209378">(Apr 12 2019 at 17:24)</a>:</h4>
<p>anyway I know you're busy, leaving a few notes as to what work is needed is fine</p>



<a name="163209382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209382">(Apr 12 2019 at 17:24)</a>:</h4>
<p>lemme grab it</p>



<a name="163209384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209384">(Apr 12 2019 at 17:24)</a>:</h4>
<blockquote>
<p>copypaste another place that does it already</p>
</blockquote>
<p>preferably not literally copy-paste, refactoring a bit would be good?</p>



<a name="163209385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209385">(Apr 12 2019 at 17:24)</a>:</h4>
<p>I am also happy to do so</p>



<a name="163209404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209404">(Apr 12 2019 at 17:25)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> I mean it might be one line :P?</p>



<a name="163209419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209419">(Apr 12 2019 at 17:25)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  fiiine :P</p>



<a name="163209495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209495">(Apr 12 2019 at 17:26)</a>:</h4>
<p>so... maybe we can iterate on the RFC together then?</p>



<a name="163209507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209507">(Apr 12 2019 at 17:26)</a>:</h4>
<p>as in, the bulk of the operation is likely already present elsewhere</p>



<a name="163209510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209510">(Apr 12 2019 at 17:26)</a>:</h4>
<p>the RFC does't seem like it should be that hard to write</p>



<a name="163209512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209512">(Apr 12 2019 at 17:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  also, if it is as little work as <span class="user-mention" data-user-id="119009">@eddyb</span> describes then a new WG sounds overkill</p>



<a name="163209518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209518">(Apr 12 2019 at 17:26)</a>:</h4>
<p>(though I would be curious to think through how things would work if supertraits were permitted to be cyclic)</p>



<a name="163209526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209526">(Apr 12 2019 at 17:26)</a>:</h4>
<p>regardles I think we want this upcast :)</p>



<a name="163209529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209529">(Apr 12 2019 at 17:26)</a>:</h4>
<p>ughhh niko how much I hate now you naming a trait resolution thing a "vtable"</p>



<a name="163209534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209534">(Apr 12 2019 at 17:26)</a>:</h4>
<p>even though it's not &gt;:P</p>



<a name="163209541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209541">(Apr 12 2019 at 17:26)</a>:</h4>
<p>(going to be afk for a bit)</p>



<a name="163209573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209573">(Apr 12 2019 at 17:27)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/librustc/traits/util.rs#L475" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc/traits/util.rs#L475">https://github.com/rust-lang/rust/blob/master/src/librustc/traits/util.rs#L475</a></p>



<a name="163209580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209580">(Apr 12 2019 at 17:27)</a>:</h4>
<p>yeah, the rfc is probably not hard to write, but some busy work</p>



<a name="163209601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209601">(Apr 12 2019 at 17:27)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3028-L3032" target="_blank" title="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3028-L3032">https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3028-L3032</a></p>



<a name="163209665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209665">(Apr 12 2019 at 17:28)</a>:</h4>
<p>we already compute the base of <code>SuperTrait</code>'s methods in <code>SubTrait</code>'s vtable</p>



<a name="163209686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209686">(Apr 12 2019 at 17:28)</a>:</h4>
<p>like, vtable layout is already done by the trait system</p>



<a name="163209709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209709">(Apr 12 2019 at 17:29)</a>:</h4>
<blockquote>
<p>ughhh niko how much I hate now you naming a trait resolution thing a "vtable"</p>
</blockquote>
<p>this confused the hell out of me for a while haha</p>



<a name="163209715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209715">(Apr 12 2019 at 17:29)</a>:</h4>
<p>you just need to do a <code>+ 3</code> in a strategic place :P</p>



<a name="163209751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209751">(Apr 12 2019 at 17:29)</a>:</h4>
<p>to get <code>trait Foo: Sup1 + Sup2</code> to reuse the magical 3 for <code>Sup1</code> but duplicate them for <code>Sup2</code></p>



<a name="163209895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209895">(Apr 12 2019 at 17:31)</a>:</h4>
<p>someone needs to write a bunch of tests as well</p>



<a name="163209905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209905">(Apr 12 2019 at 17:31)</a>:</h4>
<p>what's this magical 3? :-P</p>



<a name="163209910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209910">(Apr 12 2019 at 17:31)</a>:</h4>
<p>for the implementation</p>



<a name="163209913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209913">(Apr 12 2019 at 17:31)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> you know that's you ;-)</p>



<a name="163209915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209915">(Apr 12 2019 at 17:31)</a>:</h4>
<p>mr. tests</p>



<a name="163209925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209925">(Apr 12 2019 at 17:31)</a>:</h4>
<p><span aria-label="sob" class="emoji emoji-1f62d" role="img" title="sob">:sob:</span></p>



<a name="163209934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163209934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163209934">(Apr 12 2019 at 17:32)</a>:</h4>
<p>yeah maybe ;)</p>



<a name="163210069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210069">(Apr 12 2019 at 17:33)</a>:</h4>
<p>I'll copy the RFC template over to <a href="https://github.com/rust-lang/wg-traits" target="_blank" title="https://github.com/rust-lang/wg-traits">https://github.com/rust-lang/wg-traits</a>  and we can work on it there</p>



<a name="163210139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210139">(Apr 12 2019 at 17:34)</a>:</h4>
<p>3 is drop+size+align</p>



<a name="163210196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210196">(Apr 12 2019 at 17:35)</a>:</h4>
<blockquote>
<p>(going to be afk for a bit)</p>
</blockquote>
<p>sorry, back</p>



<a name="163210284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210284">(Apr 12 2019 at 17:36)</a>:</h4>
<p>for tests we need to check both the static and dynamic semantics</p>



<a name="163210297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210297">(Apr 12 2019 at 17:36)</a>:</h4>
<blockquote>
<p>3 is drop+size+align</p>
</blockquote>
<p>oh I see. just three usize's or something to offset eh?</p>



<a name="163210319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210319">(Apr 12 2019 at 17:36)</a>:</h4>
<p>but there's no syntax to check here at least</p>



<a name="163210362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210362">(Apr 12 2019 at 17:37)</a>:</h4>
<p>actually, we can iterate on tests in the same place?</p>



<a name="163210381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210381">(Apr 12 2019 at 17:37)</a>:</h4>
<p>oh yeaaaah sooo</p>



<a name="163210382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210382">(Apr 12 2019 at 17:37)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3032" target="_blank" title="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3032">https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3032</a></p>



<a name="163210469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210469">(Apr 12 2019 at 17:38)</a>:</h4>
<blockquote>
<p>actually, we can iterate on tests in the same place?</p>
</blockquote>
<p>feel free to make a subdirectory there</p>



<a name="163210639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210639">(Apr 12 2019 at 17:41)</a>:</h4>
<p>replace the <code>.sum()</code> with <code>.fold(None, |i, n| Some(i.map_or(0, |i| i + 3) + n)).unwrap_or(0)</code></p>



<a name="163210642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210642">(Apr 12 2019 at 17:41)</a>:</h4>
<p>or... something like that</p>



<a name="163210773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210773">(Apr 12 2019 at 17:42)</a>:</h4>
<p>so this is for calling methods on trait objects</p>



<a name="163210804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210804">(Apr 12 2019 at 17:43)</a>:</h4>
<p>interesting</p>



<a name="163210812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210812">(Apr 12 2019 at 17:43)</a>:</h4>
<p>for the cast you'd need to do this exact <code>vtable_base</code> thing, to figure out how much you need to offset</p>



<a name="163210819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210819">(Apr 12 2019 at 17:43)</a>:</h4>
<p>do you want to write this up into a few notes on GH or HackMD when you have a moment?</p>



<a name="163210822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210822">(Apr 12 2019 at 17:43)</a>:</h4>
<p>then I can have a go maybe</p>



<a name="163210826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210826">(Apr 12 2019 at 17:43)</a>:</h4>
<p>I mean, this is it?</p>



<a name="163210849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210849">(Apr 12 2019 at 17:43)</a>:</h4>
<blockquote>
<p>(though I would be curious to think through how things would work if supertraits were permitted to be cyclic)</p>
</blockquote>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> maybe let's dig into this?</p>



<a name="163210852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210852">(Apr 12 2019 at 17:43)</a>:</h4>
<p>basically there's 3 more entries before each supertrait other than the first one</p>



<a name="163210913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210913">(Apr 12 2019 at 17:44)</a>:</h4>
<p>that's all my <code>fold</code> does</p>



<a name="163210942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210942">(Apr 12 2019 at 17:44)</a>:</h4>
<p>Okay, I can have a go then... will need to reread later though</p>



<a name="163210957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163210957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163210957">(Apr 12 2019 at 17:44)</a>:</h4>
<blockquote>
<p>basically there's 3 more entries before each supertrait other than the first one</p>
</blockquote>
<p>what do you mean?</p>



<a name="163211094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211094">(Apr 12 2019 at 17:46)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> </p>
<blockquote>
<p>Since we don't have that default in the context of trait objects, it makes no sense to suppress it (particularly since it would be an error).</p>
</blockquote>
<p>It sounds like you are saying that <code>dyn ?Sized</code> should still be an error, right?</p>



<a name="163211139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211139">(Apr 12 2019 at 17:47)</a>:</h4>
<p>I would make it an error, yes. Or at least I see no reason to accept it, though I guess it's also not <em>harmful</em> to do so.</p>



<a name="163211160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211160">(Apr 12 2019 at 17:47)</a>:</h4>
<p>like, if you have traits <code>Sup1 { a, b }</code>, <code>Sup2 { c, d }</code> and <code>Sub: Sup1 + Sup2 { e, f }</code> (those are methods)</p>



<a name="163211180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211180">(Apr 12 2019 at 17:47)</a>:</h4>
<p>right now the vtable (ignoring the first 3) is <code>a b c d e f</code></p>



<a name="163211271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211271">(Apr 12 2019 at 17:48)</a>:</h4>
<blockquote>
<p>maybe let's dig into this?</p>
</blockquote>
<p><span class="user-mention" data-user-id="126931">@centril</span> thinking more about it, I don't really see that there would be a problem -- if you had each vtable having pointer to the parent vtables, then you'd just have a cycle amongst them, for example.</p>



<a name="163211282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211282">(Apr 12 2019 at 17:48)</a>:</h4>
<p>I'm saying it becomes <code>a b D S A c d e f</code></p>



<a name="163211316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211316">(Apr 12 2019 at 17:49)</a>:</h4>
<p>I've not been closely following what <span class="user-mention" data-user-id="119009">@eddyb</span> is suggesting, it sounds maybe like they're suggesting an alternative approach in which you adjust the pointer for methods to the right offset (which I think implies we have to duplicate the "magic 3" fields)</p>



<a name="163211317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211317">(Apr 12 2019 at 17:49)</a>:</h4>
<p>with the full vtable being <code>D S A a b D S A c d e f</code> (while today it's <code>D S A a b c d e f</code>)</p>



<a name="163211329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211329">(Apr 12 2019 at 17:49)</a>:</h4>
<blockquote>
<p>I would make it an error, yes. Or at least I see no reason to accept it, though I guess it's also not <em>harmful</em> to do so.</p>
</blockquote>
<p>annoying thing is that maybe bounds are lost by the time we get to typeck</p>



<a name="163211332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211332">(Apr 12 2019 at 17:49)</a>:</h4>
<p>yeah ofc you need to duplicate them</p>



<a name="163211336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211336">(Apr 12 2019 at 17:49)</a>:</h4>
<p>wait did everyone discuss something else?</p>



<a name="163211341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211341">(Apr 12 2019 at 17:49)</a>:</h4>
<p>I don't think this "embedding" approach works as well for cyclic relations</p>



<a name="163211347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211347">(Apr 12 2019 at 17:49)</a>:</h4>
<p>/me pretends to have been paying attention</p>



<a name="163211350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211350">(Apr 12 2019 at 17:49)</a>:</h4>
<p>No, I said there are two ways, and that is one of them</p>



<a name="163211358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211358">(Apr 12 2019 at 17:49)</a>:</h4>
<p>the other way would be to have the vtables embed pointers to the other vtables</p>



<a name="163211359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211359">(Apr 12 2019 at 17:49)</a>:</h4>
<p>I think this is the one we can trivially do today</p>



<a name="163211370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211370">(Apr 12 2019 at 17:50)</a>:</h4>
<p>and it's not much of a perf loss</p>



<a name="163211431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211431">(Apr 12 2019 at 17:50)</a>:</h4>
<p>(if at all)</p>



<a name="163211432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211432">(Apr 12 2019 at 17:50)</a>:</h4>
<p>neither has perf loss</p>



<a name="163211441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211441">(Apr 12 2019 at 17:50)</a>:</h4>
<p>but I'm in favor of the one with less work</p>



<a name="163211457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211457">(Apr 12 2019 at 17:50)</a>:</h4>
<p>embedding pointers means virtual calls are more expensive</p>



<a name="163211460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211460">(Apr 12 2019 at 17:50)</a>:</h4>
<p>I mean what I imagined more precisely is that the vtable for <code>Foo</code> would embed all the methods of <code>Foo</code> and its supertraits;</p>



<a name="163211470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211470">(Apr 12 2019 at 17:50)</a>:</h4>
<p>but <em>also</em> pointers to the vtables of the supertraits</p>



<a name="163211475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211475">(Apr 12 2019 at 17:50)</a>:</h4>
<p>oh that sounds silly though?</p>



<a name="163211478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211478">(Apr 12 2019 at 17:50)</a>:</h4>
<p>why?</p>



<a name="163211484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211484">(Apr 12 2019 at 17:50)</a>:</h4>
<p>it supports cycles, among other things :)</p>



<a name="163211499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211499">(Apr 12 2019 at 17:51)</a>:</h4>
<p>you're duplicating more. and do we have <em>any</em> plans for cycles?</p>



<a name="163211511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211511">(Apr 12 2019 at 17:51)</a>:</h4>
<p>you're not duplicating more</p>



<a name="163211518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211518">(Apr 12 2019 at 17:51)</a>:</h4>
<p>I mean you have to duplicate 3 fields per supertrait</p>



<a name="163211521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211521">(Apr 12 2019 at 17:51)</a>:</h4>
<p>I am duplicating 1</p>



<a name="163211524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211524">(Apr 12 2019 at 17:51)</a>:</h4>
<p>er, adding 1</p>



<a name="163211530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211530">(Apr 12 2019 at 17:51)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> why is the second D S A before <code>c d</code> and not <code>e f</code>?</p>



<a name="163211532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211532">(Apr 12 2019 at 17:51)</a>:</h4>
<p>and anyway come on, it's vtables</p>



<a name="163211535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211535">(Apr 12 2019 at 17:51)</a>:</h4>
<p>but you have 3 + methods elsewhere</p>



<a name="163211539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211539">(Apr 12 2019 at 17:51)</a>:</h4>
<p>why*</p>



<a name="163211629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211629">(Apr 12 2019 at 17:52)</a>:</h4>
<p>so e.g. for <code>trait Foo: Bar + Baz</code>, you would be adding 6 fields to the vtable for <code>Foo</code></p>



<a name="163211632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211632">(Apr 12 2019 at 17:52)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> because all 3 traits have the prefix</p>



<a name="163211636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211636">(Apr 12 2019 at 17:52)</a>:</h4>
<p>I would add 2</p>



<a name="163211653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211653">(Apr 12 2019 at 17:52)</a>:</h4>
<p>in both cases I imagine we'll still need to generate vtables for <code>Bar</code> and <code>Baz</code></p>



<a name="163211658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211658">(Apr 12 2019 at 17:52)</a>:</h4>
<p>though you could imagine not doing so</p>



<a name="163211662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211662">(Apr 12 2019 at 17:52)</a>:</h4>
<p>but it'd be hard across crates etc</p>



<a name="163211686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211686">(Apr 12 2019 at 17:53)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> <code>Sub</code> shares it with <code>Sup1</code></p>



<a name="163211688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211688">(Apr 12 2019 at 17:53)</a>:</h4>
<p>(what am I missing?)</p>



<a name="163211694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211694">(Apr 12 2019 at 17:53)</a>:</h4>
<p>this means with my version, single-inheritance is zero-cost :P</p>



<a name="163211711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211711">(Apr 12 2019 at 17:53)</a>:</h4>
<p>cross-crate reuse has been solved by mw :P</p>



<a name="163211731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211731">(Apr 12 2019 at 17:53)</a>:</h4>
<p>we have infra in the compiler to reuse any monomorphization downstream</p>



<a name="163211869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211869">(Apr 12 2019 at 17:55)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> I don't get it... a b c d e f are all separate methods right? so why would e f apply to Sup2?</p>



<a name="163211903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211903">(Apr 12 2019 at 17:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> if you never coerce <code>P&lt;T&gt;</code> to either <code>P&lt;Sup1&gt;</code> or <code>P&lt;Sup2&gt;</code> directly, then you don't even need <code>T as Sup1</code> or <code>T as Sup2</code> vtables</p>



<a name="163211979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163211979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163211979">(Apr 12 2019 at 17:56)</a>:</h4>
<p>you use 17 x usize, I use 12 x usize</p>



<a name="163212057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212057">(Apr 12 2019 at 17:57)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ugh I tried to keep it a tiny example. basically the nesting is like this:</p>
<div class="codehilite"><pre><span></span>((D S A a b) (D S A c d) e f)
</pre></div>



<a name="163212061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212061">(Apr 12 2019 at 17:57)</a>:</h4>
<p>(deleted)</p>



<a name="163212195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212195">(Apr 12 2019 at 17:58)</a>:</h4>
<p><code>Sub</code> and <code>Sup1</code> share the first <code>D S A</code>, while <code>Sup2</code> needs its own</p>



<a name="163212318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212318">(Apr 12 2019 at 18:00)</a>:</h4>
<p>oh sorry</p>



<a name="163212321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212321">(Apr 12 2019 at 18:00)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> if you never coerce <code>P&lt;T&gt;</code> to either <code>P&lt;Sup1&gt;</code> or <code>P&lt;Sup2&gt;</code> directly, then you don't even need <code>T as Sup1</code> or <code>T as Sup2</code> vtables</p>
</blockquote>
<p>I don't know how you could know that</p>



<a name="163212326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212326">(Apr 12 2019 at 18:00)</a>:</h4>
<p>got my associativity all wrong haha</p>



<a name="163212335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212335">(Apr 12 2019 at 18:00)</a>:</h4>
<p>but also I don't care to argue about this</p>



<a name="163212338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212338">(Apr 12 2019 at 18:00)</a>:</h4>
<p>do whaever</p>



<a name="163212343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212343">(Apr 12 2019 at 18:00)</a>:</h4>
<p>I also don't care how man words are in m vtables</p>



<a name="163212345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212345">(Apr 12 2019 at 18:00)</a>:</h4>
<p>no, I mean</p>



<a name="163212350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212350">(Apr 12 2019 at 18:00)</a>:</h4>
<p>we build vtables on demand</p>



<a name="163212355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212355">(Apr 12 2019 at 18:00)</a>:</h4>
<p>so yeah, makes sense now eddyb</p>



<a name="163212366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212366">(Apr 12 2019 at 18:00)</a>:</h4>
<p>so we would only need all 3 if there were unsizing coercions</p>



<a name="163212371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212371">(Apr 12 2019 at 18:01)</a>:</h4>
<p>I mean you leave the pointers to supertrait vtables as NULL, or not include them</p>



<a name="163212393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212393">(Apr 12 2019 at 18:01)</a>:</h4>
<p>but I still don't think you can know that</p>



<a name="163212401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212401">(Apr 12 2019 at 18:01)</a>:</h4>
<p>i.e., you have to include all the data for a potential upcast</p>



<a name="163212405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212405">(Apr 12 2019 at 18:01)</a>:</h4>
<p>no, that's not what I was referring to</p>



<a name="163212408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212408">(Apr 12 2019 at 18:01)</a>:</h4>
<p>because you could return the trait object to something outside of the crate</p>



<a name="163212411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212411">(Apr 12 2019 at 18:01)</a>:</h4>
<p>and it might do the upcast</p>



<a name="163212416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212416">(Apr 12 2019 at 18:01)</a>:</h4>
<p>if you don't use pointers, you don't need to create those vtables</p>



<a name="163212421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212421">(Apr 12 2019 at 18:01)</a>:</h4>
<p>oh, I see</p>



<a name="163212422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212422">(Apr 12 2019 at 18:01)</a>:</h4>
<p>unless there is a direct cast</p>



<a name="163212426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212426">(Apr 12 2019 at 18:01)</a>:</h4>
<p>sure, ok</p>



<a name="163212428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212428">(Apr 12 2019 at 18:01)</a>:</h4>
<p>/me shrugs</p>



<a name="163212431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212431">(Apr 12 2019 at 18:01)</a>:</h4>
<p>whoop-dee-doo :P</p>



<a name="163212435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212435">(Apr 12 2019 at 18:01)</a>:</h4>
<p>offsetting is also cheaper</p>



<a name="163212442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212442">(Apr 12 2019 at 18:02)</a>:</h4>
<p>yes, that is true</p>



<a name="163212492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212492">(Apr 12 2019 at 18:02)</a>:</h4>
<p>is there a way to handle cycles with offsetting?</p>



<a name="163212502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212502">(Apr 12 2019 at 18:02)</a>:</h4>
<p>and I'd just make cyclic traits not object-safe</p>



<a name="163212509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212509">(Apr 12 2019 at 18:02)</a>:</h4>
<p>why?</p>



<a name="163212518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212518">(Apr 12 2019 at 18:02)</a>:</h4>
<p>just so we can shave off a few cycles?</p>



<a name="163212522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212522">(Apr 12 2019 at 18:02)</a>:</h4>
<p>because they're an abomination :P?</p>



<a name="163212540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212540">(Apr 12 2019 at 18:02)</a>:</h4>
<p>and they complicate everything</p>



<a name="163212541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212541">(Apr 12 2019 at 18:02)</a>:</h4>
<p>I mean right now it's an error anyway, so it's fine</p>



<a name="163212550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212550">(Apr 12 2019 at 18:02)</a>:</h4>
<p>so we can decide this later</p>



<a name="163212554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212554">(Apr 12 2019 at 18:02)</a>:</h4>
<p>but yeah you can do it with offsets</p>



<a name="163212562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212562">(Apr 12 2019 at 18:03)</a>:</h4>
<p>maybe I'm missing something, but it's not very clear how you would do that</p>



<a name="163212594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212594">(Apr 12 2019 at 18:03)</a>:</h4>
<p>I guess you lay out the whole cycle as a unit and you know you can do some negative offsets or something</p>



<a name="163212604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212604">(Apr 12 2019 at 18:03)</a>:</h4>
<p>I mean, it's physically possible, it just requires a... yeah that</p>



<a name="163212609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212609">(Apr 12 2019 at 18:03)</a>:</h4>
<p>yeah, ok</p>



<a name="163212615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212615">(Apr 12 2019 at 18:03)</a>:</h4>
<p>at that point there is no reason to offset at all</p>



<a name="163212621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212621">(Apr 12 2019 at 18:03)</a>:</h4>
<p>anyway, as I said, offsets seems fine to me, particularly since I agree it's probably easier</p>



<a name="163212631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212631">(Apr 12 2019 at 18:03)</a>:</h4>
<p>all traits in the cyclic group (which I can't remember the proper word for)</p>



<a name="163212640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212640">(Apr 12 2019 at 18:04)</a>:</h4>
<p>SCC, yes, ok</p>



<a name="163212651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212651">(Apr 12 2019 at 18:04)</a>:</h4>
<p>would just use the same vtable</p>



<a name="163212676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212676">(Apr 12 2019 at 18:04)</a>:</h4>
<p>that's a good point :)</p>



<a name="163212703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212703">(Apr 12 2019 at 18:04)</a>:</h4>
<p><em>they are one trait</em></p>



<a name="163212704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212704">(Apr 12 2019 at 18:04)</a>:</h4>
<p>(that's actually kind of neat) =)</p>



<a name="163212709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212709">(Apr 12 2019 at 18:04)</a>:</h4>
<p>in any case, can you not have special logic for traits with cycles if you need to?</p>



<a name="163212715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212715">(Apr 12 2019 at 18:04)</a>:</h4>
<p>this is another reason cycles are silly</p>



<a name="163212723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212723">(Apr 12 2019 at 18:04)</a>:</h4>
<p>I don't agree it's silly but we'll leave it</p>



<a name="163212737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212737">(Apr 12 2019 at 18:04)</a>:</h4>
<p>mutual cyclical things are one cyclical thing</p>



<a name="163212751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212751">(Apr 12 2019 at 18:04)</a>:</h4>
<p>(I think it's useful to isolate out independent "views" on the same set of methods)</p>



<a name="163212766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212766">(Apr 12 2019 at 18:05)</a>:</h4>
<p>but it's not a big thing, I agree they are logically one trait</p>



<a name="163212774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212774">(Apr 12 2019 at 18:05)</a>:</h4>
<p>soo....</p>



<a name="163212787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212787">(Apr 12 2019 at 18:05)</a>:</h4>
<p>I would hate it if we couldn't find a nicer way to do that than mutually cyclical traits :P</p>



<a name="163212794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212794">(Apr 12 2019 at 18:05)</a>:</h4>
<p>anyway I gotta run y'all but seems like we are underway, I think it'd be a good idea to step back and write out the actual steps</p>



<a name="163212797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212797">(Apr 12 2019 at 18:05)</a>:</h4>
<p>and who will be doing them:)</p>



<a name="163212808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212808">(Apr 12 2019 at 18:06)</a>:</h4>
<p>we probably have rough implementation notes from <span class="user-mention" data-user-id="119009">@eddyb</span> 's messages here already. would you mind filtering them out into a short post though, just for a) the record (and whoever writes the RFC), b) my sanity? :-)</p>



<a name="163212860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212860">(Apr 12 2019 at 18:06)</a>:</h4>
<p>yep, thanks <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="163212872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212872">(Apr 12 2019 at 18:06)</a>:</h4>
<p>So we have:<br>
1. implementation -- <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> <br>
2. tests -- ??<br>
3. rfc -- ??</p>



<a name="163212898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212898">(Apr 12 2019 at 18:07)</a>:</h4>
<p>2. tests -- centril<br>
3. rfc -- niko?</p>



<a name="163212902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212902">(Apr 12 2019 at 18:07)</a>:</h4>
<p>;-)</p>



<a name="163212936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212936">(Apr 12 2019 at 18:07)</a>:</h4>
<p>I can probably write a bit on the rfc</p>



<a name="163212947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212947">(Apr 12 2019 at 18:07)</a>:</h4>
<p>you might want to get <span class="user-mention" data-user-id="124288">@oli</span> in on this</p>



<a name="163212949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212949">(Apr 12 2019 at 18:07)</a>:</h4>
<p>I'll leave the representation bits to someone else, but those are not specified anyways so we can be light on this</p>



<a name="163212955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163212955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163212955">(Apr 12 2019 at 18:07)</a>:</h4>
<p>wrt miri and layout of vtables</p>



<a name="163213009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213009">(Apr 12 2019 at 18:08)</a>:</h4>
<p>like, actually building them. I hope that code has been deduplicated already</p>



<a name="163213026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213026">(Apr 12 2019 at 18:08)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  iirc  <span class="user-mention" data-user-id="120791">@RalfJ</span>  made a PR re. <code>dyn FnOnce</code> so maybe they are familiar as well</p>



<a name="163213057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213057">(Apr 12 2019 at 18:09)</a>:</h4>
<p>not related I don't think</p>



<a name="163213066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213066">(Apr 12 2019 at 18:09)</a>:</h4>
<p>but <span class="user-mention" data-user-id="120791">@RalfJ</span> is indeed the other person working on miri :P</p>



<a name="163213389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213389">(Apr 12 2019 at 18:13)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  anyway does the above sound okay re notes?</p>



<a name="163213538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213538">(Apr 12 2019 at 18:15)</a>:</h4>
<p>replace the <code>.sum()</code> with <code>.fold(None, |i, n| Some(i.map_or(0, |i| i + 3) + n)).unwrap_or(0)</code> in <a href="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3032" target="_blank" title="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3032">https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3032</a></p>



<a name="163213552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213552">(Apr 12 2019 at 18:15)</a>:</h4>
<p>that was the main thing of note :P</p>



<a name="163213662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213662">(Apr 12 2019 at 18:16)</a>:</h4>
<p>and, yeah, look at <code>ObjectCandidate</code> / <code>VtableObject</code> (it's for <code>dyn SubTrait: SuperTrait</code>)</p>



<a name="163213668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213668">(Apr 12 2019 at 18:16)</a>:</h4>
<p>oh, actually, it's not just for method calls, my bad</p>



<a name="163213726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213726">(Apr 12 2019 at 18:17)</a>:</h4>
<p>yeah so <code>dyn SubTrait -&gt; dyn SuperTrait</code> can just add an <code>ObjectCandidate</code></p>



<a name="163213825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213825">(Apr 12 2019 at 18:18)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> okay thanks. what about MIR?</p>



<a name="163213839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213839">(Apr 12 2019 at 18:18)</a>:</h4>
<p>what about it?</p>



<a name="163213844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213844">(Apr 12 2019 at 18:18)</a>:</h4>
<p>nothing to be done there?</p>



<a name="163213880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213880">(Apr 12 2019 at 18:18)</a>:</h4>
<p>not that I can think of</p>



<a name="163213903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213903">(Apr 12 2019 at 18:19)</a>:</h4>
<p>this is a <code>dyn SubTrait: Unsize&lt;dyn SuperTrait&gt;</code> coercion</p>



<a name="163213912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213912">(Apr 12 2019 at 18:19)</a>:</h4>
<p>okay... just miri stuff, and that can be done by oli later maybe?</p>



<a name="163213931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213931">(Apr 12 2019 at 18:19)</a>:</h4>
<p><code>dyn Foo + Send: Unsize&lt;dyn Foo&gt;</code> exists today</p>



<a name="163213945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213945">(Apr 12 2019 at 18:19)</a>:</h4>
<p>it's allowed here, specifically <a href="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L2183-L2185" target="_blank" title="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L2183-L2185">https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L2183-L2185</a></p>



<a name="163213956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163213956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163213956">(Apr 12 2019 at 18:19)</a>:</h4>
<p>the miri stuff is creating the vtable :P</p>



<a name="163214052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214052">(Apr 12 2019 at 18:20)</a>:</h4>
<p>but basically, if you remove this condition <a href="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L2182" target="_blank" title="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L2182">https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L2182</a></p>



<a name="163214077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214077">(Apr 12 2019 at 18:21)</a>:</h4>
<p>then here the two traits could differ: <a href="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3299" target="_blank" title="https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3299">https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/librustc/traits/select.rs#L3299</a></p>



<a name="163214117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214117">(Apr 12 2019 at 18:21)</a>:</h4>
<p>and you can <code>nested.push(...)</code> a <code>dyn A: B</code> obligation</p>



<a name="163214181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214181">(Apr 12 2019 at 18:22)</a>:</h4>
<p>okay...</p>



<a name="163214203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214203">(Apr 12 2019 at 18:22)</a>:</h4>
<p>I don't get what I have to do with miri though.</p>



<a name="163214209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214209">(Apr 12 2019 at 18:22)</a>:</h4>
<p>you can ask someone who knows trait stuff about that, or just guess from looking around (I'd be just doing the latter if you wanted me to help)</p>



<a name="163214211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214211">(Apr 12 2019 at 18:22)</a>:</h4>
<p>did you refer to that before?</p>



<a name="163214219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214219">(Apr 12 2019 at 18:22)</a>:</h4>
<p>yeah, vtables</p>



<a name="163214229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214229">(Apr 12 2019 at 18:22)</a>:</h4>
<p>miri builds the actual vtable bytes, so to say</p>



<a name="163214249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214249">(Apr 12 2019 at 18:23)</a>:</h4>
<p><code>ObjectCandidate</code> and <code>VtableObject</code> are miri? didn't know that ha</p>



<a name="163214254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214254">(Apr 12 2019 at 18:23)</a>:</h4>
<p>I see</p>



<a name="163214256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214256">(Apr 12 2019 at 18:23)</a>:</h4>
<p>no</p>



<a name="163214268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214268">(Apr 12 2019 at 18:23)</a>:</h4>
<p>those are traits::select</p>



<a name="163214354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214354">(Apr 12 2019 at 18:24)</a>:</h4>
<p>nevermind, I'm wrong <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_ssa/meth.rs#L69" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_ssa/meth.rs#L69">https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_ssa/meth.rs#L69</a></p>



<a name="163214363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214363">(Apr 12 2019 at 18:24)</a>:</h4>
<p>this was supposed to be deduplicated into miri ages ago :(</p>



<a name="163214368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214368">(Apr 12 2019 at 18:24)</a>:</h4>
<p>I guess it hasn't happened yet</p>



<a name="163214494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214494">(Apr 12 2019 at 18:26)</a>:</h4>
<p>so basically here you just need to inject the 3 D S A entries before the actual methods <a href="https://github.com/rust-lang/rust/blob/2226c09699a96520238e162777f44504f4a0a1a7/src/librustc/traits/mod.rs#L991" target="_blank" title="https://github.com/rust-lang/rust/blob/2226c09699a96520238e162777f44504f4a0a1a7/src/librustc/traits/mod.rs#L991">https://github.com/rust-lang/rust/blob/2226c09699a96520238e162777f44504f4a0a1a7/src/librustc/traits/mod.rs#L991</a></p>



<a name="163214530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214530">(Apr 12 2019 at 18:26)</a>:</h4>
<p>(by replacing the <code>Option</code> with an <code>enum</code> indicating what data is in that entry)</p>



<a name="163214590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214590">(Apr 12 2019 at 18:27)</a>:</h4>
<p>alternatively, change <code>&amp;'tcx [Option&lt;(DefId, SubstsRef&lt;'tcx&gt;)&gt;]</code> in the return to <code>&amp;'tcx [&amp;'tcx [Option&lt;(DefId, SubstsRef&lt;'tcx&gt;)&gt;]]</code> to make it clear how the methods are split into traits :P</p>



<a name="163214611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214611">(Apr 12 2019 at 18:27)</a>:</h4>
<p><code>(DefId, SubstsRef&lt;'tcx&gt;)</code> also sounds like it should be an <code>Instance</code>, heh</p>



<a name="163214783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163214783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163214783">(Apr 12 2019 at 18:29)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> okay, I think that should be reasonably clear now. I'll have a look soon. thanks! (and I'll let you bug Oli or Ralf about deduplicating that code heh)</p>



<a name="163223176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163223176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163223176">(Apr 12 2019 at 20:18)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> </p>
<blockquote>
<p>like, actually building them. I hope that code has been deduplicated already</p>
</blockquote>
<p>not that I know of</p>



<a name="163229820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163229820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163229820">(Apr 12 2019 at 21:49)</a>:</h4>
<blockquote>
<p>like, actually building them. I hope that code has been deduplicated already</p>
</blockquote>
<p>it has not</p>



<a name="163229825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163229825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163229825">(Apr 12 2019 at 21:50)</a>:</h4>
<p>oh lol</p>



<a name="163229878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163229878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163229878">(Apr 12 2019 at 21:50)</a>:</h4>
<p>I should've scrolled down</p>



<a name="163229942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163229942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163229942">(Apr 12 2019 at 21:51)</a>:</h4>
<p>we can try dedupicating, but we need to bench that, because in many cases it might be more effort since we're creating miri allocations just to write them back to llvm</p>



<a name="163266297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163266297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163266297">(Apr 13 2019 at 13:50)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> worst case we replace the <code>vtable_methods</code> query with one that produces a list of vtable entries :P</p>



<a name="163266302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163266302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163266302">(Apr 13 2019 at 13:50)</a>:</h4>
<p>but really, if a constant does an unsizing, we already use the miri vtable instead of the LLVM one...</p>



<a name="163266314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/163266314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#163266314">(Apr 13 2019 at 13:51)</a>:</h4>
<p>so I don't see any point in not using the miri one</p>



<a name="164938205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/164938205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#164938205">(May 05 2019 at 21:52)</a>:</h4>
<blockquote>
<p><code>Sub</code> and <code>Sup1</code> share the first <code>D S A</code>, while <code>Sup2</code> needs its own</p>
</blockquote>
<p>why can they share  the first? <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="164975121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/164975121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#164975121">(May 06 2019 at 11:49)</a>:</h4>
<p>uhhh</p>



<a name="164975541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/164975541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#164975541">(May 06 2019 at 11:56)</a>:</h4>
<p>my point is that you can have <code>Sub</code> share a prefix with with <code>Sup1</code> or <code>Sup2</code>, because you can start <code>Sub</code>'s vtable with <code>D S A</code> followed by their respective methods</p>



<a name="164975550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/164975550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#164975550">(May 06 2019 at 11:56)</a>:</h4>
<p>but you can't have both <code>Sup1</code> and <code>Sup2</code> share the same <code>D S A</code></p>



<a name="165030483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165030483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165030483">(May 07 2019 at 00:07)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> okay, I guess I'll see <em>why</em> that's the case as I proceed... I thought that D S A would  need to be different for <code>Sub</code> and <code>Sup1</code> because fundamentally they're different types, but...</p>



<a name="165030996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165030996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165030996">(May 07 2019 at 00:18)</a>:</h4>
<p>OH!</p>



<a name="165031002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031002">(May 07 2019 at 00:18)</a>:</h4>
<p>that's where the confusion was</p>



<a name="165031006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031006">(May 07 2019 at 00:19)</a>:</h4>
<p><code>Sub</code> and <code>Sup1</code> are traits</p>



<a name="165031035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031035">(May 07 2019 at 00:19)</a>:</h4>
<p>the vtable is for a given type that implements those traits, and D/S/A are properties of that type that are always the same no matter what trait you're talking about</p>



<a name="165031098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031098">(May 07 2019 at 00:20)</a>:</h4>
<p>like, it's almost literally <code>(ptr::drop_in_place::&lt;T&gt;, mem::size_of::&lt;T&gt;(), mem::align_of::&lt;T&gt;())</code></p>



<a name="165031115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031115">(May 07 2019 at 00:21)</a>:</h4>
<p>they're followed by, say, <code>&lt;T as Sup1&gt;::whatever_method_name</code> function pointers, but the D S A prefix is always the same for a given <code>T</code></p>



<a name="165031598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031598">(May 07 2019 at 00:30)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> ohh, I see (I think). so the second D S A is just a duplicate of the first in the vtable (in your above example)?</p>



<a name="165031602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031602">(May 07 2019 at 00:31)</a>:</h4>
<p>yupp</p>



<a name="165031624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031624">(May 07 2019 at 00:31)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> thanks. all clear now.</p>



<a name="165031829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165031829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165031829">(May 07 2019 at 00:36)</a>:</h4>
<blockquote>
<p>alternatively, change <code>&amp;'tcx [Option&lt;(DefId, SubstsRef&lt;'tcx&gt;)&gt;]</code> in the return to <code>&amp;'tcx [&amp;'tcx [Option&lt;(DefId, SubstsRef&lt;'tcx&gt;)&gt;]]</code> to make it clear how the methods are split into traits :P</p>
</blockquote>
<p>is this your preferred alternative, @eddyb? that is, <code>&amp;'tcx [Instance]</code>?</p>



<a name="165714203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165714203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165714203">(May 15 2019 at 13:29)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> is this how I registeer the obligation in <code>confirm_builtin_unsize_candidate</code>?</p>



<a name="165714213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165714213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165714213">(May 15 2019 at 13:29)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="c1">// Register an obligation for `TraitA: TraitB`.</span>
<span class="w">                </span><span class="n">nested</span><span class="p">.</span><span class="n">extend</span><span class="p">(</span><span class="w"></span>
<span class="w">                    </span><span class="n">data_b</span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="n">d</span><span class="o">|</span><span class="w"> </span><span class="n">predicate_to_obligation</span><span class="p">(</span><span class="n">d</span><span class="p">.</span><span class="n">with_self_ty</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">source_ty</span><span class="p">))),</span><span class="w"></span>
<span class="w">                </span><span class="p">);</span><span class="w"></span>
</pre></div>



<a name="165717833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165717833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165717833">(May 15 2019 at 14:13)</a>:</h4>
<p>sorry, I gtg, but I'll take a look at it later</p>



<a name="165727847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165727847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165727847">(May 15 2019 at 16:09)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> no prob</p>



<a name="165746973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165746973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165746973">(May 15 2019 at 19:35)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> that should read <code>dyn TraitA: TraitB</code> BTW. I can  paste the  whole file  if you like, but I think that's the relevant bit</p>



<a name="165783279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165783279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165783279">(May 16 2019 at 06:21)</a>:</h4>
<p>I think that's correct</p>



<a name="165817738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165817738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165817738">(May 16 2019 at 14:57)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> okay thanks. I think something went wrong with my staged build, because it (kind of) worked now. I'm working on the MIR part now...</p>



<a name="165819698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165819698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165819698">(May 16 2019 at 15:17)</a>:</h4>
<p>looks <em>reasonably</em> straightforward.</p>



<a name="165819704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165819704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165819704">(May 16 2019 at 15:18)</a>:</h4>
<p>unless I've misunderstood something</p>



<a name="165851741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165851741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165851741">(May 16 2019 at 21:43)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> might be nice to provide <code>Read</code> and <code>Write</code> impls for <code>Cursor&lt;mir::Memory&gt;</code> or something no?</p>



<a name="165985341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/165985341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#165985341">(May 18 2019 at 18:20)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> noticed the PR I opened yet?</p>



<a name="166080932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/166080932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#166080932">(May 20 2019 at 12:35)</a>:</h4>
<p>nope, I'm back at the office today but idk how much time I'll have to review it</p>



<a name="166081009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/166081009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#166081009">(May 20 2019 at 12:36)</a>:</h4>
<p>as for miri things, talk to <span class="user-mention" data-user-id="124288">@oli</span> (<code>Read</code>/<code>Write</code> don't seem that fitting, especially without the ability to change the error type from <code>io::Error</code>)</p>



<a name="166086697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/166086697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#166086697">(May 20 2019 at 13:54)</a>:</h4>
<p>I'm not sure what <code>mir::Memory</code> is, but if you mean <code>mir::interpret::Memory</code>, I have no idea what <code>Read</code> and <code>Write</code> would even do on a <code>Memory</code></p>



<a name="166092835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/166092835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#166092835">(May 20 2019 at 15:11)</a>:</h4>
<p>don't worry, it was a silly idea</p>



<a name="166092855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/166092855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#166092855">(May 20 2019 at 15:11)</a>:</h4>
<p>I took another approach, which you seemed to have liked in the end.</p>



<a name="166092928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/166092928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#166092928">(May 20 2019 at 15:12)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> and no worries. when you do have time, feedback on the bootstrapping error I posted in the PR  (to do with coercion) is the most important thing.</p>



<a name="169716196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716196">(Jul 05 2019 at 15:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> so, this is the problematic thing right now: <a href="https://github.com/rust-lang/rust/pull/60900#issuecomment-493593431" target="_blank" title="https://github.com/rust-lang/rust/pull/60900#issuecomment-493593431">https://github.com/rust-lang/rust/pull/60900#issuecomment-493593431</a></p>



<a name="169716265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716265">(Jul 05 2019 at 15:14)</a>:</h4>
<p>I see</p>



<a name="169716267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716267">(Jul 05 2019 at 15:14)</a>:</h4>
<p>presumably due to some changes to coercion</p>



<a name="169716303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716303">(Jul 05 2019 at 15:15)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> this seems to be the relevant bit of code: <a href="https://github.com/rust-lang/rust/pull/60900/commits/0dbc2adb7e7d4d078a47ad1cf554d5bc95fc50a9#r285305829" target="_blank" title="https://github.com/rust-lang/rust/pull/60900/commits/0dbc2adb7e7d4d078a47ad1cf554d5bc95fc50a9#r285305829">https://github.com/rust-lang/rust/pull/60900/commits/0dbc2adb7e7d4d078a47ad1cf554d5bc95fc50a9#r285305829</a></p>



<a name="169716408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716408">(Jul 05 2019 at 15:16)</a>:</h4>
<p>and in fact, whether or not I comment out the old bit of inference code you wrote, the error still occurs</p>



<a name="169716410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716410">(Jul 05 2019 at 15:16)</a>:</h4>
<p>Well, I think also that this change feels too loose. </p>
<div class="codehilite"><pre><span></span><span class="gd">- data_a.principal_def_id() == data_b.principal_def_id()</span>
</pre></div>



<a name="169716421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716421">(Jul 05 2019 at 15:16)</a>:</h4>
<p>though perhaps not at fault</p>



<a name="169716423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716423">(Jul 05 2019 at 15:16)</a>:</h4>
<p>so it's caused by the new code probably, even though it seems right (eddyb thought so too)</p>



<a name="169716447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716447">(Jul 05 2019 at 15:17)</a>:</h4>
<p>it may be. I did that on eddyb's suggestion too. not that I blame him, because it made sense to me too. :-)</p>



<a name="169716487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716487">(Jul 05 2019 at 15:17)</a>:</h4>
<p>the relevant new code I think is the bit beginning with <code>// Register an obligation for `dyn TraitA: TraitB`.</code></p>



<a name="169716703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716703">(Jul 05 2019 at 15:20)</a>:</h4>
<p>OK, yeah, I'm looking. Might be the easiest way to debug is to build and test.</p>



<a name="169716710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716710">(Jul 05 2019 at 15:20)</a>:</h4>
<p>yep</p>



<a name="169716723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716723">(Jul 05 2019 at 15:20)</a>:</h4>
<p>I have a build here, but you'll probably want your own</p>



<a name="169716848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716848">(Jul 05 2019 at 15:22)</a>:</h4>
<p>indeed, always easiest in the home environment</p>



<a name="169716853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716853">(Jul 05 2019 at 15:22)</a>:</h4>
<p>So, should I leave both things to you in your own time now? :-)</p>



<a name="169716864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716864">(Jul 05 2019 at 15:23)</a>:</h4>
<p>and you can just comment on the PRs or message me here</p>



<a name="169716876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716876">(Jul 05 2019 at 15:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="169716879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716879">(Jul 05 2019 at 15:23)</a>:</h4>
<p>OK, so I've kicked off a build. I think let's do this: I will add to my calendar some time to review <a href="https://github.com/rust-lang/rust/issues/61812" target="_blank" title="https://github.com/rust-lang/rust/issues/61812">#61812</a> today, and also <a href="https://github.com/rust-lang/rust/issues/60900" target="_blank" title="https://github.com/rust-lang/rust/issues/60900">#60900</a> once  can observe the problem</p>



<a name="169716903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716903">(Jul 05 2019 at 15:23)</a>:</h4>
<p>prob in an hour or so, since I have to take that other call that I moved :)</p>



<a name="169716916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716916">(Jul 05 2019 at 15:24)</a>:</h4>
<p>I'll also try to review <a href="https://github.com/rust-lang/rust/issues/61812" target="_blank" title="https://github.com/rust-lang/rust/issues/61812">#61812</a>...</p>



<a name="169716959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716959">(Jul 05 2019 at 15:24)</a>:</h4>
<p>but that's not related to you :)</p>



<a name="169716960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716960">(Jul 05 2019 at 15:24)</a>:</h4>
<p>yeah no worries Niko</p>



<a name="169716963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716963">(Jul 05 2019 at 15:24)</a>:</h4>
<p>heh</p>



<a name="169716972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169716972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169716972">(Jul 05 2019 at 15:24)</a>:</h4>
<p>when are you taking your holiday by the way?</p>



<a name="169717037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169717037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169717037">(Jul 05 2019 at 15:25)</a>:</h4>
<p>it starts July 15</p>



<a name="169717061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169717061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169717061">(Jul 05 2019 at 15:25)</a>:</h4>
<p>Okay. Couple of weeks? Longer? Just curious, so I know not to pester you when you're enjoying your time off!</p>



<a name="169717123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169717123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169717123">(Jul 05 2019 at 15:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'm confident we can get both these things sorted before then in any case. Maybe afterwards we could address impl-trait-in-bindings. (I know the intention was for you to compile the notes and musings scattered across various locations, but honestly maybe it makes more sense in terms of efficiency for me to hand over my existing work to you and me focus on other things, since you know exactly what needs to be done.)</p>



<a name="169717764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169717764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169717764">(Jul 05 2019 at 15:36)</a>:</h4>
<p>For example, maybe I can work on multi-trait objects then if we can get trait upcasting through :-)</p>



<a name="169724016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169724016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169724016">(Jul 05 2019 at 17:26)</a>:</h4>
<p>OK, <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span>, so I see the problem with upcasts. The good news is that it's, I think, a pre-existing problem. Pretty unrelated to your diff, though I think it <em>is</em> caused by the change to insert more obligations on an upcast coercion than we used to.</p>



<a name="169724037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169724037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169724037">(Jul 05 2019 at 17:27)</a>:</h4>
<p>i.e., that makes us prove something we never had to prove before</p>



<a name="169724144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169724144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169724144">(Jul 05 2019 at 17:29)</a>:</h4>
<p>Here is a minimized example illustrating the problem (<a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=a4379d24c52512644ab3fc0444ad2167" target="_blank" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=a4379d24c52512644ab3fc0444ad2167">playground</a>):</p>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(optin_builtin_traits)]</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="n">auto</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="c1">// Comment this out makes the code compile:</span>
<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="o">?</span><span class="nb">Sized</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Bar</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="o">?</span><span class="nb">Sized</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">Foo</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Bar</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">Foo</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="169724161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169724161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169724161">(Jul 05 2019 at 17:29)</a>:</h4>
<p>In short, we get an ambiguity because <code>dyn Bar + Foo: Foo</code> holds in 2 different ways -- one via the impl, the other via the nature of object types.</p>



<a name="169724241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169724241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169724241">(Jul 05 2019 at 17:30)</a>:</h4>
<p>Also, and completely unrelated, I wish we had made it <code>dyn (Bar + Foo)</code>. The strange precedence of <code>dyn</code> and <code>impl</code> is convenient sometimes but man it reads odd to me. =)</p>



<a name="169724364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169724364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169724364">(Jul 05 2019 at 17:33)</a>:</h4>
<p>I think this is only really relevant because of a somewhat epic hack we are using to make "dual mode" thread-safety compiles. We could plausibly do that hack a different way and sidestep the problem. We could also handle this particular "ambiguity".</p>



<a name="169725111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169725111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169725111">(Jul 05 2019 at 17:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I thought it was pre-existing too, indeed.</p>



<a name="169725157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169725157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169725157">(Jul 05 2019 at 17:48)</a>:</h4>
<p>Yeah, I don't like that precedence either overmuch heh...</p>



<a name="169725174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169725174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169725174">(Jul 05 2019 at 17:48)</a>:</h4>
<p>anyway, I see the problem now, thanks for explaining</p>



<a name="169725178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169725178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169725178">(Jul 05 2019 at 17:48)</a>:</h4>
<p>what's your inclination when it comes to solving it?</p>



<a name="169725530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169725530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169725530">(Jul 05 2019 at 17:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> anyway much appreciated. if you could leave instructions here, I may be able to have a go at tackling it over the weekend... whichever approach you prefer.</p>



<a name="169732926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169732926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169732926">(Jul 05 2019 at 20:06)</a>:</h4>
<blockquote>
<p>what's your inclination when it comes to solving it?</p>
</blockquote>
<p>I'm debating this <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> =) there is also this soundness issue that I've been meaning to review that is totally related.</p>



<a name="169732966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169732966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169732966">(Jul 05 2019 at 20:07)</a>:</h4>
<p>One obvious thing would be to give precedence to object candidates, but that's a tricky question that has implications for type inference and I don't love it.</p>



<a name="169733019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169733019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169733019">(Jul 05 2019 at 20:08)</a>:</h4>
<p>Another would be to revise the coercion logic to add fewer obligations =) that would probably just sidestep the problem enough for now and leave it for another day (though we should file an issue)</p>



<a name="169733025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169733025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169733025">(Jul 05 2019 at 20:08)</a>:</h4>
<p>BTW <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> you should consider landing that "cleanup commit" separately</p>



<a name="169733032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169733032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169733032">(Jul 05 2019 at 20:08)</a>:</h4>
<p>i.e., in a separate PR</p>



<a name="169733037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169733037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169733037">(Jul 05 2019 at 20:08)</a>:</h4>
<p>ah well I guess we've been back and forth on this :P</p>



<a name="169733049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169733049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169733049">(Jul 05 2019 at 20:09)</a>:</h4>
<p>I'm only mentioning it because it was sort of annoying when trying to read the diffs, though having it at the beginning was a big help as  I Could do <code>git diff 12312414...</code> or whatever</p>



<a name="169733061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169733061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169733061">(Jul 05 2019 at 20:09)</a>:</h4>
<blockquote>
<p>Another would be to revise the coercion logic to add fewer obligations =) that would probably just sidestep the problem enough for now and leave it for another day (though we should file an issue)</p>
</blockquote>
<p>this is probably the thing to do for now</p>



<a name="169733068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169733068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169733068">(Jul 05 2019 at 20:09)</a>:</h4>
<p>but I have to think what that means</p>



<a name="169742379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169742379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169742379">(Jul 05 2019 at 23:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> sure... I just thought those "aggregated drive-by  changes" (admittedly quite a few of them) were more likely to get merged as a separate commit in the same PR. :-)</p>



<a name="169742423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169742423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169742423">(Jul 05 2019 at 23:54)</a>:</h4>
<p>anyway, I'll try to look at the coercion logic for now, thanks</p>



<a name="169742432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/169742432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#169742432">(Jul 05 2019 at 23:54)</a>:</h4>
<blockquote>
<p>In short, we get an ambiguity because <code>dyn Bar + Foo: Foo</code> holds in 2 different ways -- one via the impl, the other via the nature of object types.</p>
</blockquote>
<p>does it require that both hold right now? maybe we just want "at least one" to hold?</p>



<a name="172514134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/172514134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#172514134">(Aug 05 2019 at 15:43)</a>:</h4>
<blockquote>
<p>I think this is only really relevant because of a somewhat epic hack we are using to make "dual mode" thread-safety compiles. We could plausibly do that hack a different way and sidestep the problem. We could also handle this particular "ambiguity".</p>
</blockquote>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> <span class="user-mention" data-user-id="121053">@varkor</span> is either of you aware of this "epic hack" / where it is / how we could tackle it differently to avoid this problem?</p>



<a name="172514304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/172514304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#172514304">(Aug 05 2019 at 15:46)</a>:</h4>
<p>I'm not sure, no</p>



<a name="172516208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/172516208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#172516208">(Aug 05 2019 at 16:09)</a>:</h4>
<p>no prob</p>



<a name="172516321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/172516321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#172516321">(Aug 05 2019 at 16:11)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> did you see my comment about my PR involving type-checking for ATB though? I thought maybe you'd be a good person to review. it's not too much to review, and Niko already partially reviewed and left notes how he wanted it (re)done... no great rush, but if you can look at it at some point this week, then great.</p>



<a name="172516356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/172516356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#172516356">(Aug 05 2019 at 16:11)</a>:</h4>
<p>I haven't checked GH properly yet today — I'll take a look later 👍</p>



<a name="172516623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/172516623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#172516623">(Aug 05 2019 at 16:15)</a>:</h4>
<p>Cool, thanks.</p>



<a name="174252048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252048">(Aug 27 2019 at 17:43)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span></p>



<a name="174252055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252055">(Aug 27 2019 at 17:43)</a>:</h4>
<p>Hey Niko.</p>



<a name="174252061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252061">(Aug 27 2019 at 17:43)</a>:</h4>
<p>got a bit of time now then?</p>



<a name="174252068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252068">(Aug 27 2019 at 17:43)</a>:</h4>
<p>A bit, yeah</p>



<a name="174252127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252127">(Aug 27 2019 at 17:44)</a>:</h4>
<p>So I guess this is still blocking you :)</p>



<a name="174252136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252136">(Aug 27 2019 at 17:44)</a>:</h4>
<p>yeah, a bit...</p>



<a name="174252149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252149">(Aug 27 2019 at 17:44)</a>:</h4>
<p>I suppose it would be nice to decide which of your two suggested approaches to take</p>



<a name="174252154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252154">(Aug 27 2019 at 17:44)</a>:</h4>
<p>and what exactly I need to do</p>



<a name="174252164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252164">(Aug 27 2019 at 17:44)</a>:</h4>
<p>you went over them at a high level above.</p>



<a name="174252398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252398">(Aug 27 2019 at 17:47)</a>:</h4>
<p>Yeah I'm reviewing the code</p>



<a name="174252407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252407">(Aug 27 2019 at 17:47)</a>:</h4>
<p>The epic hack I was referring to are these <a href="https://github.com/rust-lang/rust/blob/0396aace27eea97c3603e9683e921807dff2a314/src/librustc_data_structures/sync.rs#L54-L55" target="_blank" title="https://github.com/rust-lang/rust/blob/0396aace27eea97c3603e9683e921807dff2a314/src/librustc_data_structures/sync.rs#L54-L55">duplicate Send + Sync auto traits</a></p>



<a name="174252599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252599">(Aug 27 2019 at 17:49)</a>:</h4>
<p>oh I see</p>



<a name="174252658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252658">(Aug 27 2019 at 17:50)</a>:</h4>
<p>hrmm</p>



<a name="174252676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174252676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174252676">(Aug 27 2019 at 17:50)</a>:</h4>
<p>and they're needed why exactly?</p>



<a name="174253067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253067">(Aug 27 2019 at 17:54)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="174253486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253486">(Aug 27 2019 at 18:00)</a>:</h4>
<p>well, they're used to "cross-compile" the compiler between thread-safe and not thread-safe</p>



<a name="174253507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253507">(Aug 27 2019 at 18:00)</a>:</h4>
<p>the types always say <code>librustc_data_structures::sync::Send</code> and whatever</p>



<a name="174253519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253519">(Aug 27 2019 at 18:00)</a>:</h4>
<p>when in thread-safe mode, that is the normal <code>Send</code></p>



<a name="174253536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253536">(Aug 27 2019 at 18:00)</a>:</h4>
<p>but otherwise it's this "no-op" Send that is defined for all types</p>



<a name="174253550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253550">(Aug 27 2019 at 18:01)</a>:</h4>
<p>the reason that <em>your code</em> is hitting problems -- which is what I was just researching -- is <a href="https://github.com/rust-lang/rust/pull/60900/files#diff-bab18e2cba63e19e514ac06a633a873cR3411" target="_blank" title="https://github.com/rust-lang/rust/pull/60900/files#diff-bab18e2cba63e19e514ac06a633a873cR3411">this code here</a>:</p>



<a name="174253658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253658">(Aug 27 2019 at 18:02)</a>:</h4>
<p>oh</p>



<a name="174253669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253669">(Aug 27 2019 at 18:02)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="n">nested</span><span class="p">.</span><span class="n">extend</span><span class="p">(</span><span class="w"></span>
<span class="w">                    </span><span class="n">data_b</span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="n">d</span><span class="o">|</span><span class="w"> </span><span class="n">predicate_to_obligation</span><span class="p">(</span><span class="n">d</span><span class="p">.</span><span class="n">with_self_ty</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">source_ty</span><span class="p">))),</span><span class="w"></span>
<span class="w">                </span><span class="p">);</span><span class="w"></span>
</pre></div>



<a name="174253672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253672">(Aug 27 2019 at 18:02)</a>:</h4>
<p>of course</p>



<a name="174253675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253675">(Aug 27 2019 at 18:02)</a>:</h4>
<p>not that the code is <em>wrong</em></p>



<a name="174253689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253689">(Aug 27 2019 at 18:02)</a>:</h4>
<p>mhm...</p>



<a name="174253715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253715">(Aug 27 2019 at 18:02)</a>:</h4>
<p>but when you upcast from <code>dyn Foo + Send + 'a</code> to <code>dyn Foo + Send + 'b</code></p>



<a name="174253731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253731">(Aug 27 2019 at 18:02)</a>:</h4>
<p>it winds up forcing us to prove <code>dyn Foo + Send: Send</code></p>



<a name="174253739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253739">(Aug 27 2019 at 18:02)</a>:</h4>
<p>which in turn hits that ambiguous case</p>



<a name="174253813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253813">(Aug 27 2019 at 18:03)</a>:</h4>
<p>right</p>



<a name="174253850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253850">(Aug 27 2019 at 18:04)</a>:</h4>
<p>this is a more general problem though, isn't it?</p>



<a name="174253867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253867">(Aug 27 2019 at 18:04)</a>:</h4>
<p>it is but I'm not sure I want to fix it in this PR :)</p>



<a name="174253884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253884">(Aug 27 2019 at 18:04)</a>:</h4>
<p>so one option might be to (somewhat hackily) avoid generating that obligation</p>



<a name="174253894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253894">(Aug 27 2019 at 18:04)</a>:</h4>
<p>because a trait object can implement a trait by <code>impl</code> or it being a "supertrait"</p>



<a name="174253912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253912">(Aug 27 2019 at 18:04)</a>:</h4>
<p>mhm...</p>



<a name="174253930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174253930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174253930">(Aug 27 2019 at 18:04)</a>:</h4>
<p>(there is also a related soundness problem, as an aside...)</p>



<a name="174254020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254020">(Aug 27 2019 at 18:06)</a>:</h4>
<p>anyway a hack that would suffice to <em>unblock the PR</em> might be to look for auto traits that are already included in the list and skip them or something</p>



<a name="174254051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254051">(Aug 27 2019 at 18:06)</a>:</h4>
<p>hmm</p>



<a name="174254060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254060">(Aug 27 2019 at 18:06)</a>:</h4>
<p>yes, does sound quite hacky though</p>



<a name="174254076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254076">(Aug 27 2019 at 18:06)</a>:</h4>
<p>I'm doing a build with those lines commented out, as an aside, just to test my hypothesis</p>



<a name="174254091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254091">(Aug 27 2019 at 18:06)</a>:</h4>
<p>do you not want to go for a more solid solution right away?</p>



<a name="174254092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254092">(Aug 27 2019 at 18:06)</a>:</h4>
<p>it got farther</p>



<a name="174254095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254095">(Aug 27 2019 at 18:06)</a>:</h4>
<p>I don't mind really</p>



<a name="174254096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254096">(Aug 27 2019 at 18:06)</a>:</h4>
<p>okay.</p>



<a name="174254152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254152">(Aug 27 2019 at 18:07)</a>:</h4>
<div class="codehilite"><pre><span></span>error[E0284]: type annotations required: cannot resolve `&lt;_ as context::Context&gt;::GoalInEnvironment == &lt;I as context::Context&gt;::GoalInEnvironment`
   --&gt; /home/nmatsakis/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-engine-0.9.0/src/logic.rs:675:48
    |
675 |             Literal::Positive(subgoal) =&gt; self.abstract_positive_literal(infer, subgoal),
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^
</pre></div>



<a name="174254156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254156">(Aug 27 2019 at 18:07)</a>:</h4>
<p>not sure what's up with <em>that</em></p>



<a name="174254169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254169">(Aug 27 2019 at 18:07)</a>:</h4>
<p>anyway, I think I would try to add some kind of "skip auto traits" check with a FIXME</p>



<a name="174254173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254173">(Aug 27 2019 at 18:07)</a>:</h4>
<p>we could file a related issue, using my example above</p>



<a name="174254235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254235">(Aug 27 2019 at 18:08)</a>:</h4>
<p>the idea would be to say "if you are upcasting to <code>X</code> and the original type includes the auto trait <code>X</code>, skip it" -- though we might want to be sure it's an auto trait with no type parameters</p>



<a name="174254263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254263">(Aug 27 2019 at 18:08)</a>:</h4>
<p>yeah. I didn't know chalk was being used already by default though...?</p>



<a name="174254271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254271">(Aug 27 2019 at 18:08)</a>:</h4>
<p>mhm</p>



<a name="174254280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254280">(Aug 27 2019 at 18:08)</a>:</h4>
<p>sounds fair enough</p>



<a name="174254297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254297">(Aug 27 2019 at 18:08)</a>:</h4>
<p>how would you see a less hacky fix going though?</p>



<a name="174254360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254360">(Aug 27 2019 at 18:09)</a>:</h4>
<p>well, e.g. for chalk, it isn't necessary to find a unique path necessarily</p>



<a name="174254373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254373">(Aug 27 2019 at 18:09)</a>:</h4>
<p>so one option would be to just not have a problem with multiple options</p>



<a name="174254412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254412">(Aug 27 2019 at 18:10)</a>:</h4>
<p>but that requires some deeper changes in how trait resolution works</p>



<a name="174254642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254642">(Aug 27 2019 at 18:12)</a>:</h4>
<p>I see</p>



<a name="174254645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174254645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174254645">(Aug 27 2019 at 18:12)</a>:</h4>
<p>so many best just to leave that to you and the Chalk guys?</p>



<a name="174255218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255218">(Aug 27 2019 at 18:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> anyway I'll try your hack suggestion, thanks. if you have an idea about that subsequent error, let me know (maybe I won't run into it if I'm lucky though?)</p>



<a name="174255282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255282">(Aug 27 2019 at 18:20)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> yeah I'm hoping you don't :)</p>



<a name="174255287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255287">(Aug 27 2019 at 18:20)</a>:</h4>
<p>I did a hackier change, after all</p>



<a name="174255295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255295">(Aug 27 2019 at 18:20)</a>:</h4>
<p>exactly</p>



<a name="174255298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255298">(Aug 27 2019 at 18:20)</a>:</h4>
<p>but let me know and I'll do some debugging</p>



<a name="174255307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255307">(Aug 27 2019 at 18:20)</a>:</h4>
<p>and that error msg is very weird heh</p>



<a name="174255351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255351">(Aug 27 2019 at 18:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I have a few thing I want to do after this trait upcasting gets merged (apart from getting my REPL project published and whatnot), but maybe I can start getting more involved with Chalk then. I'd like to... let's see.</p>



<a name="174255359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255359">(Aug 27 2019 at 18:21)</a>:</h4>
<p>I suppose we'll be having meetings again now, at least.</p>



<a name="174255361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174255361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174255361">(Aug 27 2019 at 18:21)</a>:</h4>
<p>traits-WG ones</p>



<a name="174256756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174256756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174256756">(Aug 27 2019 at 18:37)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> random question: is the best (easiest?) way to check whether a ty implements a trait – outside of type checking/inference phase – to do <code>tcx.infer_ctxt().enter(|infcx| { infcx.at().sub(...) })</code> – or something like that?</p>



<a name="174256789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174256789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174256789">(Aug 27 2019 at 18:37)</a>:</h4>
<p>I guess I'd just give some empty <code>ParamEnv</code> too</p>



<a name="174266476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174266476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174266476">(Aug 27 2019 at 20:10)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> no, the best way is to use the <code>evaluate_obligation</code> query</p>



<a name="174312348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174312348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174312348">(Aug 27 2019 at 21:28)</a>:</h4>
<p>Okay thanks!</p>



<a name="174843830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/174843830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#174843830">(Sep 04 2019 at 01:20)</a>:</h4>
<p>Okay thanks!</p>



<a name="175377929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175377929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175377929">(Sep 10 2019 at 21:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> We'll talk here then.</p>



<a name="175385534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175385534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175385534">(Sep 10 2019 at 22:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> got a little time for this today or not? no worries if not.</p>



<a name="175473965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175473965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175473965">(Sep 11 2019 at 20:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> how about today? :-)</p>



<a name="175483340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483340">(Sep 11 2019 at 22:54)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span>, sorry, today was crazy so far</p>



<a name="175483341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483341">(Sep 11 2019 at 22:54)</a>:</h4>
<p>Let me review the PR :)</p>



<a name="175483348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483348">(Sep 11 2019 at 22:54)</a>:</h4>
<p>hey, no problem...</p>



<a name="175483349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483349">(Sep 11 2019 at 22:54)</a>:</h4>
<p>cheers!</p>



<a name="175483386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483386">(Sep 11 2019 at 22:55)</a>:</h4>
<p>is current status still that those examples don't work, <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ?</p>



<a name="175483391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483391">(Sep 11 2019 at 22:55)</a>:</h4>
<p>yeah</p>



<a name="175483393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483393">(Sep 11 2019 at 22:55)</a>:</h4>
<p>if so, it does seem like it's probably some kind of vtable counting problem</p>



<a name="175483432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483432">(Sep 11 2019 at 22:56)</a>:</h4>
<p>the bit of code I highlighted in my last comment is surely the key</p>



<a name="175483437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483437">(Sep 11 2019 at 22:56)</a>:</h4>
<p>yeah, prob, let me do a local build</p>



<a name="175483440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483440">(Sep 11 2019 at 22:56)</a>:</h4>
<p>the question is how to go about it... do I use <code>old_info</code> in some way? do I do a query? do I reuse the vtable counting code from <code>select.rs</code> somehow?</p>



<a name="175483441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483441">(Sep 11 2019 at 22:56)</a>:</h4>
<p>(since this is in codegen)</p>



<a name="175483538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483538">(Sep 11 2019 at 22:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ^</p>



<a name="175483687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483687">(Sep 11 2019 at 23:00)</a>:</h4>
<p>hmm</p>



<a name="175483698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483698">(Sep 11 2019 at 23:00)</a>:</h4>
<p>remind me, we are doing the "roll out all the methods into the vtable" approach, right?</p>



<a name="175483701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483701">(Sep 11 2019 at 23:00)</a>:</h4>
<p>i.e., one big flat vtable?</p>



<a name="175483711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483711">(Sep 11 2019 at 23:00)</a>:</h4>
<p>yeah</p>



<a name="175483738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483738">(Sep 11 2019 at 23:01)</a>:</h4>
<p>there's a <code>flat_map</code> somewhere that does that, I forget where exactly...</p>



<a name="175483746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483746">(Sep 11 2019 at 23:01)</a>:</h4>
<p>I guess I would expect you'd do some sort of query, yes, but I'm not sure just what</p>



<a name="175483750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483750">(Sep 11 2019 at 23:01)</a>:</h4>
<p>would have to look at the <a href="http://select.rs" target="_blank" title="http://select.rs">select.rs</a> code I guess</p>



<a name="175483801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483801">(Sep 11 2019 at 23:02)</a>:</h4>
<p>the vtable looks like D S A [trait methods] D S A [supertrait 1 methods] D S A [supertrait 2 methods] ...</p>



<a name="175483806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483806">(Sep 11 2019 at 23:02)</a>:</h4>
<p>yeah...</p>



<a name="175483820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483820">(Sep 11 2019 at 23:02)</a>:</h4>
<p>I just want to avoid the compiler duplicating work as much as possible, really</p>



<a name="175483856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483856">(Sep 11 2019 at 23:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> grep for <code>count_own_vtable_entries</code> in the diff and you'll see the relevant <a href="http://select.rs" target="_blank" title="http://select.rs">select.rs</a> code</p>



<a name="175483861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483861">(Sep 11 2019 at 23:03)</a>:</h4>
<p>it's simple</p>



<a name="175483873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483873">(Sep 11 2019 at 23:03)</a>:</h4>
<p>well, ish</p>



<a name="175483941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483941">(Sep 11 2019 at 23:04)</a>:</h4>
<p>there's a <code>supertraits</code> query</p>



<a name="175483946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175483946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175483946">(Sep 11 2019 at 23:04)</a>:</h4>
<p>which I may need to repeat...?</p>



<a name="175489938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175489938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175489938">(Sep 12 2019 at 00:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> still building? :-)</p>



<a name="175522715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175522715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175522715">(Sep 12 2019 at 12:15)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> sorry, didn't finish before I had to log out for the night :)</p>



<a name="175554656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175554656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175554656">(Sep 12 2019 at 18:05)</a>:</h4>
<p>ah okay</p>



<a name="175554664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175554664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175554664">(Sep 12 2019 at 18:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> today...?</p>



<a name="175640604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175640604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175640604">(Sep 13 2019 at 16:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'll be out the rest of today, but feel free to leave notes while I'm gone, if you have thoughts.</p>



<a name="175656726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175656726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175656726">(Sep 13 2019 at 19:29)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> my build of your branch is dying with this error</p>
<div class="codehilite"><pre><span></span>error[E0283]: type annotations required: cannot resolve `dyn emitter::Emitter + rustc_data_structures::sync::Send: rustc_data_structures::sync::Send`
</pre></div>


<p>is that expected?</p>



<a name="175663349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/175663349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#175663349">(Sep 13 2019 at 20:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> oh sorry. The way I built it was with <code>—keep-stage 0</code> after building master stage 0. Easier to debug that way.</p>



<a name="176118088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176118088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176118088">(Sep 19 2019 at 16:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> hey. did you get it built yet then?</p>



<a name="176118096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176118096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176118096">(Sep 19 2019 at 16:45)</a>:</h4>
<p>anyway you may just want  to look at the bit of code I highlighted</p>



<a name="176118099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176118099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176118099">(Sep 19 2019 at 16:45)</a>:</h4>
<p>in my comment on GH</p>



<a name="176118121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176118121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176118121">(Sep 19 2019 at 16:45)</a>:</h4>
<p>and tell  me roughly what should go there :-)</p>



<a name="176207481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176207481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176207481">(Sep 20 2019 at 16:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> well, I'll have a go doing a  trait query there and see if I get progress...</p>



<a name="176227750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176227750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176227750">(Sep 20 2019 at 20:28)</a>:</h4>
<p>Sorry <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> been slammed this wek</p>



<a name="176227773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176227773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176227773">(Sep 20 2019 at 20:28)</a>:</h4>
<p>Trying to catch up a bit</p>



<a name="176228242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176228242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176228242">(Sep 20 2019 at 20:34)</a>:</h4>
<p>However, I didn't get this building, no -- I'm confused are you just using --keep-stage0 to work around the other problem for now?</p>



<a name="176229030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176229030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176229030">(Sep 20 2019 at 20:46)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> well, I'm using it  just to get rustc building</p>



<a name="176229045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176229045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176229045">(Sep 20 2019 at 20:46)</a>:</h4>
<p>so I can test it on smaller examples</p>



<a name="176229046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176229046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176229046">(Sep 20 2019 at 20:46)</a>:</h4>
<p>rather than all of rustc</p>



<a name="176230507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176230507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176230507">(Sep 20 2019 at 21:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> don't worry if you don't  have time today though</p>



<a name="176230512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176230512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176230512">(Sep 20 2019 at 21:06)</a>:</h4>
<p>I'll try anyway</p>



<a name="176230526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176230526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176230526">(Sep 20 2019 at 21:07)</a>:</h4>
<p>I wouldn't think you'd gain much by a working  build like me anyway</p>



<a name="176230531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176230531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176230531">(Sep 20 2019 at 21:07)</a>:</h4>
<p>it's mainly about what to put in that bit of codeen_ssa</p>



<a name="176407493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176407493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176407493">(Sep 23 2019 at 20:40)</a>:</h4>
<blockquote>
<p>well, I'm using it  just to get rustc building</p>
</blockquote>
<p><em>oh</em>, I see</p>



<a name="176407525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176407525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176407525">(Sep 23 2019 at 20:41)</a>:</h4>
<p>useful hack, yes</p>



<a name="176559730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176559730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176559730">(Sep 25 2019 at 12:40)</a>:</h4>
<p>In answer to your question <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> -- in codegen, when we dispatch a <code>foo.bar()</code> call, we invoke <a href="https://github.com/rust-lang/rust/blob/c7bc0bf82faf9718fa1e59a38f5aab308299ba7d/src/librustc/traits/codegen/mod.rs#L21-L24" target="_blank" title="https://github.com/rust-lang/rust/blob/c7bc0bf82faf9718fa1e59a38f5aab308299ba7d/src/librustc/traits/codegen/mod.rs#L21-L24"><code>codegen_fulfill_obligation</code></a></p>



<a name="176566955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176566955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176566955">(Sep 25 2019 at 13:59)</a>:</h4>
<p>okay, thanks</p>



<a name="176566979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176566979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176566979">(Sep 25 2019 at 13:59)</a>:</h4>
<p>I'll still need to do a query in the codegen for the upcast then, I suppose? don't see a way around it</p>



<a name="176570532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176570532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176570532">(Sep 25 2019 at 14:37)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> can you send me a quick link to where you would need the info?</p>



<a name="176570537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176570537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176570537">(Sep 25 2019 at 14:37)</a>:</h4>
<p>sorry if the link's already in the PR</p>



<a name="176572673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176572673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176572673">(Sep 25 2019 at 14:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah, it's here: <a href="https://github.com/rust-lang/rust/blob/45859b7ca764cafb14efb8c63a83d5e48dc5d016/src/librustc_codegen_ssa/base.rs#L141" target="_blank" title="https://github.com/rust-lang/rust/blob/45859b7ca764cafb14efb8c63a83d5e48dc5d016/src/librustc_codegen_ssa/base.rs#L141">https://github.com/rust-lang/rust/blob/45859b7ca764cafb14efb8c63a83d5e48dc5d016/src/librustc_codegen_ssa/base.rs#L141</a></p>



<a name="176572731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176572731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176572731">(Sep 25 2019 at 14:57)</a>:</h4>
<p>also curious how I do a pointer offset in codegen_ssa (I have basicaly no experience with codegen in rustc, I'm afraid.)</p>



<a name="176573115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176573115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176573115">(Sep 25 2019 at 15:01)</a>:</h4>
<p>so yeah, if we can figure out how to do that, and get the appropriate <code>VtableObject</code> value, then bingo.</p>



<a name="176590486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176590486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176590486">(Sep 25 2019 at 18:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> hmm, so maybe I can/should call <code>codegen_fulfill_obligation</code> from within the <code>unsized_info</code> method?</p>



<a name="176590499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176590499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176590499">(Sep 25 2019 at 18:01)</a>:</h4>
<p>(in codegen_ssa)</p>



<a name="176668243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176668243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176668243">(Sep 26 2019 at 15:29)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> you said that <span class="user-mention" data-user-id="119009">@eddyb</span> helped you out here, or do you still have pending questions?</p>



<a name="176668551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176668551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176668551">(Sep 26 2019 at 15:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> doing some experimentation right now. so I'll see shortly. would be good to have a short sync anyway, if you don't mind. we can cut it short if we don't need all the time?</p>



<a name="176672139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176672139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176672139">(Sep 26 2019 at 16:16)</a>:</h4>
<p>he's gone AFK for now, but here's my last question <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="176672140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176672140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176672140">(Sep 26 2019 at 16:16)</a>:</h4>
<p>my wider issue is basically that in codegen_rvalue_operand, for unsizing, I need to do something equivalent to coerce_unsized_into but for operands. do I need to make that fn more abstract (to work on operands... not sure how exactly), or do something similar to codegen_rvalue in codegen_rvalue_operand (for unsizing)?</p>



<a name="176675643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675643">(Sep 26 2019 at 17:00)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="116009">@nikomatsakis</span>. around now?  :-)</p>



<a name="176675760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675760">(Sep 26 2019 at 17:01)</a>:</h4>
<p>yep, just reading your last few comments</p>



<a name="176675835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675835">(Sep 26 2019 at 17:02)</a>:</h4>
<p>I'm going to have to go read into that code</p>



<a name="176675846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675846">(Sep 26 2019 at 17:02)</a>:</h4>
<p>it is pretty thoroughly out of cache</p>



<a name="176675860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675860">(Sep 26 2019 at 17:02)</a>:</h4>
<p>okay thanks</p>



<a name="176675868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675868">(Sep 26 2019 at 17:02)</a>:</h4>
<p>ps, is your branch up to date?</p>



<a name="176675873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675873">(Sep 26 2019 at 17:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I can push my WIP code right now if you like too</p>



<a name="176675882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675882">(Sep 26 2019 at 17:02)</a>:</h4>
<p>heh</p>



<a name="176675885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675885">(Sep 26 2019 at 17:02)</a>:</h4>
<p>let me do that.</p>



<a name="176675896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176675896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176675896">(Sep 26 2019 at 17:02)</a>:</h4>
<p>always useful, thanks</p>



<a name="176676325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676325">(Sep 26 2019 at 17:09)</a>:</h4>
<blockquote>
<p>my wider issue is basically that in codegen_rvalue_operand, for unsizing, I need to do something equivalent to coerce_unsized_into but for operands. </p>
</blockquote>
<p>ok i'm looking at this fn now</p>



<a name="176676357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676357">(Sep 26 2019 at 17:09)</a>:</h4>
<p>done</p>



<a name="176676361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676361">(Sep 26 2019 at 17:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ^</p>



<a name="176676473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676473">(Sep 26 2019 at 17:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> rerunning the trait query in <code>unsized_info</code> is obviously non-ideal. I didn't properly look into your suggestion of using <code>codegen_fulfill_obligation</code> yet.</p>



<a name="176676484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676484">(Sep 26 2019 at 17:10)</a>:</h4>
<p>was focusing more  on codegn</p>



<a name="176676799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676799">(Sep 26 2019 at 17:14)</a>:</h4>
<p>yep, ok, I'm reading your code now</p>



<a name="176676814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676814">(Sep 26 2019 at 17:14)</a>:</h4>
<p>I still don't really understand <em>quite</em> what you meant when you were saying you needed "something equivalent to <code>coerce_unsized_into</code></p>



<a name="176676879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676879">(Sep 26 2019 at 17:15)</a>:</h4>
<p>okay, well...</p>



<a name="176676963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676963">(Sep 26 2019 at 17:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <code>src/librustc_codegen_ssa/mir/rvalue.rs|:227</code> (the FIXME)</p>



<a name="176676967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176676967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176676967">(Sep 26 2019 at 17:16)</a>:</h4>
<p>does that help clarify?</p>



<a name="176677119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677119">(Sep 26 2019 at 17:18)</a>:</h4>
<p>also,  note the similarity between the match expr there and the one in <code>coerce_unsized_into</code> (<code>coerce_ptr</code> closure), <span class="user-mention" data-user-id="116009">@nikomatsakis</span> (basically that one just does an additional <code>OperandValue::store</code> but is otherwise no different I think</p>



<a name="176677192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677192">(Sep 26 2019 at 17:18)</a>:</h4>
<p>hmm ok</p>



<a name="176677213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677213">(Sep 26 2019 at 17:19)</a>:</h4>
<p>is that clearer? sorry, the code is a bit messy still...</p>



<a name="176677258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677258">(Sep 26 2019 at 17:19)</a>:</h4>
<p>well.... it wasn't exactly super-clean to begin with heh.</p>



<a name="176677333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677333">(Sep 26 2019 at 17:20)</a>:</h4>
<p>it's clear-ish</p>



<a name="176677351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677351">(Sep 26 2019 at 17:20)</a>:</h4>
<p>this code has changed a lot since I last looke at it</p>



<a name="176677366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677366">(Sep 26 2019 at 17:20)</a>:</h4>
<p>well idk if that's true, maybe I just forget :)</p>



<a name="176677381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677381">(Sep 26 2019 at 17:20)</a>:</h4>
<p>heh, easily done in any casee</p>



<a name="176677541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677541">(Sep 26 2019 at 17:23)</a>:</h4>
<p>in any case, the primary difference between <code>coerce_unsized_into</code> and <code>codegen_rvalue_operand</code> is that the former starts from two LLVM "typed pointers", basically (<code>PlaceRef</code>), whereas the latter also goes from MIR?</p>



<a name="176677559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677559">(Sep 26 2019 at 17:23)</a>:</h4>
<p>er, well, I guess we also return an operand</p>



<a name="176677567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677567">(Sep 26 2019 at 17:23)</a>:</h4>
<p>right, I think so.</p>



<a name="176677572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677572">(Sep 26 2019 at 17:23)</a>:</h4>
<p>whihc I guess is sort that <code>store</code> you were talking about</p>



<a name="176677580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677580">(Sep 26 2019 at 17:23)</a>:</h4>
<p>both work with <code>OpereandValue</code>s though</p>



<a name="176677637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677637">(Sep 26 2019 at 17:24)</a>:</h4>
<p>in their corresponding matches</p>



<a name="176677675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677675">(Sep 26 2019 at 17:24)</a>:</h4>
<p>yeah so the <em>heart</em> of <code>coerce_unsized_into</code> is this code:</p>



<a name="176677691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677691">(Sep 26 2019 at 17:24)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">coerce_ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">|</span><span class="n">ty_a</span><span class="p">,</span><span class="w"> </span><span class="n">ty_b</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="p">(</span><span class="n">base</span><span class="p">,</span><span class="w"> </span><span class="n">info</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">bx</span><span class="p">.</span><span class="n">load_operand</span><span class="p">(</span><span class="n">src</span><span class="p">).</span><span class="n">val</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">OperandValue</span>::<span class="n">Pair</span><span class="p">(</span><span class="n">base</span><span class="p">,</span><span class="w"> </span><span class="n">info</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="c1">// FIXME(alexreg): this comment needs updating.</span>
<span class="w">                </span><span class="c1">// Fat-ptr to fat-ptr unsize preserves the vtable,</span>
<span class="w">                </span><span class="c1">// i.e., `&amp;&#39;a fmt::Debug + Send` =&gt; `&amp;&#39;a fmt::Debug`</span>
<span class="w">                </span><span class="c1">// So, we need to `pointercast` the base to ensure</span>
<span class="w">                </span><span class="c1">// the types match up.</span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">thin_ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">dst</span><span class="p">.</span><span class="n">layout</span><span class="p">.</span><span class="n">field</span><span class="p">(</span><span class="n">bx</span><span class="p">.</span><span class="n">cx</span><span class="p">(),</span><span class="w"> </span><span class="n">FAT_PTR_ADDR</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;FOO: FAT PTR UNSIZE&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="c1">// HACK(eddyb): have to bitcast pointers until LLVM removes pointee types.</span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">base</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bx</span><span class="p">.</span><span class="n">pointercast</span><span class="p">(</span><span class="n">base</span><span class="p">,</span><span class="w"> </span><span class="n">bx</span><span class="p">.</span><span class="n">cx</span><span class="p">().</span><span class="n">backend_type</span><span class="p">(</span><span class="n">thin_ptr</span><span class="p">));</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">info</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">unsized_info</span><span class="p">(</span><span class="n">bx</span><span class="p">,</span><span class="w"> </span><span class="n">ty_a</span><span class="p">,</span><span class="w"> </span><span class="n">ty_b</span><span class="p">,</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">info</span><span class="p">));</span><span class="w"></span>
<span class="w">                </span><span class="p">(</span><span class="n">base</span><span class="p">,</span><span class="w"> </span><span class="n">info</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="n">OperandValue</span>::<span class="n">Immediate</span><span class="p">(</span><span class="n">base</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">unsize_thin_ptr</span><span class="p">(</span><span class="n">bx</span><span class="p">,</span><span class="w"> </span><span class="n">base</span><span class="p">,</span><span class="w"> </span><span class="n">src_ty</span><span class="p">,</span><span class="w"> </span><span class="n">dst_ty</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="n">OperandValue</span>::<span class="n">Ref</span><span class="p">(..)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">bug</span><span class="o">!</span><span class="p">(),</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>
<span class="w">        </span><span class="n">OperandValue</span>::<span class="n">Pair</span><span class="p">(</span><span class="n">base</span><span class="p">,</span><span class="w"> </span><span class="n">info</span><span class="p">).</span><span class="n">store</span><span class="p">(</span><span class="n">bx</span><span class="p">,</span><span class="w"> </span><span class="n">dst</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
</pre></div>



<a name="176677706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677706">(Sep 26 2019 at 17:25)</a>:</h4>
<p>which doesn't <em>really</em> want to take a <code>PlaceRef-&gt;PlaceRef</code></p>



<a name="176677727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677727">(Sep 26 2019 at 17:25)</a>:</h4>
<p>that is, it's kind of a wrapper around a <code>Operand -&gt; OPerand</code> I think</p>



<a name="176677729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677729">(Sep 26 2019 at 17:25)</a>:</h4>
<p>right, I'm thinking that can be factored out</p>



<a name="176677736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677736">(Sep 26 2019 at 17:25)</a>:</h4>
<p>that sounds right</p>



<a name="176677737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677737">(Sep 26 2019 at 17:25)</a>:</h4>
<p>and used in <code>codegen_rvalue_operand</code></p>



<a name="176677788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677788">(Sep 26 2019 at 17:26)</a>:</h4>
<p>it seems like it is </p>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">coerce_ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">|</span><span class="n">ty_a</span><span class="p">,</span><span class="w"> </span><span class="n">ty_b</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">src_operand</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bx</span><span class="p">.</span><span class="n">load_operand</span><span class="p">(</span><span class="n">src</span><span class="p">);</span><span class="w"></span>
<span class="w">      </span><span class="kd">let</span><span class="w"> </span><span class="n">dst_operand</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">coerce_operand_operand</span><span class="p">(</span><span class="n">src_operand</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">dst_operand</span><span class="p">.</span><span class="n">store</span><span class="p">(...);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="176677826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677826">(Sep 26 2019 at 17:26)</a>:</h4>
<p>but we still need something like <code>src/librustc_codegen_ssa/base.rs:299</code> (that other match) in <code>codegen_rvalue_operand</code>, no?</p>



<a name="176677843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677843">(Sep 26 2019 at 17:26)</a>:</h4>
<p>exactly</p>



<a name="176677876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677876">(Sep 26 2019 at 17:26)</a>:</h4>
<p>maybe call it <code>fn coerce_operand_unsized</code>  though (?)</p>



<a name="176677899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677899">(Sep 26 2019 at 17:27)</a>:</h4>
<p>or <code>fn coerce_unsized_ptr</code>?</p>



<a name="176677902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677902">(Sep 26 2019 at 17:27)</a>:</h4>
<p>yeah I mean whatever :)</p>



<a name="176677904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677904">(Sep 26 2019 at 17:27)</a>:</h4>
<p>I was just being sloppy</p>



<a name="176677936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677936">(Sep 26 2019 at 17:27)</a>:</h4>
<p>yeah that's me unnecessarily focusing on details sorry heh</p>



<a name="176677940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677940">(Sep 26 2019 at 17:27)</a>:</h4>
<p>so....</p>



<a name="176677942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176677942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176677942">(Sep 26 2019 at 17:27)</a>:</h4>
<p>anyway, do you need that match on line 299...</p>



<a name="176678001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678001">(Sep 26 2019 at 17:28)</a>:</h4>
<p>I guess the answer is yes</p>



<a name="176678019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678019">(Sep 26 2019 at 17:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> well I'm alluding to something like that in <code>rvalue.rs:227</code>(the FIXME comment)</p>



<a name="176678030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678030">(Sep 26 2019 at 17:28)</a>:</h4>
<p>because we presumably want to be able to coerce (e.g.) <code>Arc&lt;Foo&gt;</code> to <code>Arc&lt;Bar&gt;</code></p>



<a name="176678045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678045">(Sep 26 2019 at 17:28)</a>:</h4>
<p>yeah</p>



<a name="176678056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678056">(Sep 26 2019 at 17:28)</a>:</h4>
<p>but all that line does</p>



<a name="176678092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678092">(Sep 26 2019 at 17:29)</a>:</h4>
<p>the final arm of that match is the tricky one though. it involves recursion of the fn.</p>



<a name="176678112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678112">(Sep 26 2019 at 17:29)</a>:</h4>
<p>well I guess the fn I wrote isn't really how you want to factor it</p>



<a name="176678120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678120">(Sep 26 2019 at 17:29)</a>:</h4>
<p>you probably want a function that takes the result of <code>load_operand</code> combined with a type</p>



<a name="176678123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678123">(Sep 26 2019 at 17:29)</a>:</h4>
<p>as the "source"</p>



<a name="176678126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678126">(Sep 26 2019 at 17:29)</a>:</h4>
<p>and seems to be predicated specifically on using places</p>



<a name="176678127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678127">(Sep 26 2019 at 17:29)</a>:</h4>
<p>and then does the match etc</p>



<a name="176678129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678129">(Sep 26 2019 at 17:29)</a>:</h4>
<p>hmm</p>



<a name="176678138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678138">(Sep 26 2019 at 17:29)</a>:</h4>
<p>oh yes</p>



<a name="176678144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678144">(Sep 26 2019 at 17:29)</a>:</h4>
<p>hmm so the final case, that's the <code>Arc&lt;...&gt;</code> cse</p>



<a name="176678151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678151">(Sep 26 2019 at 17:29)</a>:</h4>
<p>I hadn't read closely and just assumed that :-)</p>



<a name="176678152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678152">(Sep 26 2019 at 17:29)</a>:</h4>
<p>and yes it is predicated on places</p>



<a name="176678248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678248">(Sep 26 2019 at 17:30)</a>:</h4>
<p>well so the other thing you can do of course</p>



<a name="176678256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678256">(Sep 26 2019 at 17:30)</a>:</h4>
<p>is to spill :)</p>



<a name="176678266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678266">(Sep 26 2019 at 17:31)</a>:</h4>
<p>(which might well make sense)</p>



<a name="176678278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678278">(Sep 26 2019 at 17:31)</a>:</h4>
<p>see the match at <code>rvalue.rs:56</code>... I wonder if we can do something similar in <code>codgen_rvalue_operand</code>?</p>



<a name="176678281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678281">(Sep 26 2019 at 17:31)</a>:</h4>
<p>that's what I was alluding to before</p>



<a name="176678290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678290">(Sep 26 2019 at 17:31)</a>:</h4>
<p>oh, "spill"?</p>



<a name="176678298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678298">(Sep 26 2019 at 17:31)</a>:</h4>
<p>right, that's what I meant by "spill"</p>



<a name="176678301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678301">(Sep 26 2019 at 17:31)</a>:</h4>
<p>create a temporary if you need one</p>



<a name="176678322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678322">(Sep 26 2019 at 17:31)</a>:</h4>
<p>aha yep</p>



<a name="176678331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678331">(Sep 26 2019 at 17:31)</a>:</h4>
<p>that last case feels very painful to handle without spilling; you could potentially spill <em>only</em> in tha case</p>



<a name="176678387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678387">(Sep 26 2019 at 17:32)</a>:</h4>
<p>yeah, that's an interesting thought</p>



<a name="176678389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678389">(Sep 26 2019 at 17:32)</a>:</h4>
<p>you will <em>typically</em> have a <code>PlaceRef</code> anyway I think</p>



<a name="176678400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678400">(Sep 26 2019 at 17:32)</a>:</h4>
<p>well I'm not sure how <code>OperandRef</code> works exactly</p>



<a name="176678407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678407">(Sep 26 2019 at 17:32)</a>:</h4>
<p>but in the MIR you are usually casting from a place</p>



<a name="176678408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678408">(Sep 26 2019 at 17:32)</a>:</h4>
<p>would it be more efficient to special-case the last case though?</p>



<a name="176678418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678418">(Sep 26 2019 at 17:32)</a>:</h4>
<p>(in <em>theory</em> it can be a constant)</p>



<a name="176678421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678421">(Sep 26 2019 at 17:32)</a>:</h4>
<p>because it's obviously more of a pain</p>



<a name="176678428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678428">(Sep 26 2019 at 17:32)</a>:</h4>
<p>I see</p>



<a name="176678434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678434">(Sep 26 2019 at 17:32)</a>:</h4>
<p>not sure what you mean by special-case</p>



<a name="176678437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678437">(Sep 26 2019 at 17:32)</a>:</h4>
<p>I am proposing to special case it :)</p>



<a name="176678469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678469">(Sep 26 2019 at 17:33)</a>:</h4>
<p>that is, I am saying that you probably don't want to <em>always</em> create a temporary and store into it, because you typically don't need one</p>



<a name="176678619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678619">(Sep 26 2019 at 17:34)</a>:</h4>
<p>sorry, I meant whether to "special-case" in the opposite sense: not create a temporary for the simpler cases.</p>



<a name="176678627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678627">(Sep 26 2019 at 17:34)</a>:</h4>
<p>easier to write, but potentially less efficient</p>



<a name="176678675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678675">(Sep 26 2019 at 17:35)</a>:</h4>
<p>ok. yes, I think we're saying the same thing</p>



<a name="176678701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678701">(Sep 26 2019 at 17:35)</a>:</h4>
<p>I have to run but -- I can see why you find this tricky :) -- i'm starting to see what needs to be done, let me know if you do anything else and/or I'll try to look at it a bit more tomorrow</p>



<a name="176678726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678726">(Sep 26 2019 at 17:35)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> is probably also a good one to help, indeed, as they're much closer to this code than I am</p>



<a name="176678733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678733">(Sep 26 2019 at 17:36)</a>:</h4>
<p>yeah. I was basically just asking you if it's worth it in terms of efficiency (obviously will defer to you on this, since I don't fully understand thee tradeoffs!)</p>



<a name="176678805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678805">(Sep 26 2019 at 17:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> sure. as for the <code>codegen_fulfill_obligation</code>... should I be calling that from <code>unsized_info</code>, or what?</p>



<a name="176678815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678815">(Sep 26 2019 at 17:36)</a>:</h4>
<p>feel feel to reply whenever.</p>



<a name="176678822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678822">(Sep 26 2019 at 17:36)</a>:</h4>
<p>thanks for your time anyway!</p>



<a name="176678831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176678831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176678831">(Sep 26 2019 at 17:36)</a>:</h4>
<p>it's been helpful</p>



<a name="176975958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176975958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176975958">(Sep 30 2019 at 21:21)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> let's chat here</p>



<a name="176975987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176975987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176975987">(Sep 30 2019 at 21:21)</a>:</h4>
<p>so I saw the gist but maybe the best is if I just look at the state of your branch?</p>



<a name="176976062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176976062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176976062">(Sep 30 2019 at 21:22)</a>:</h4>
<p>sure</p>



<a name="176976093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176976093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176976093">(Sep 30 2019 at 21:22)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yep, let me push now...</p>



<a name="176976508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176976508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176976508">(Sep 30 2019 at 21:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> pull and grep for <code>// FIXME: what should go here?</code> :-)</p>



<a name="176976518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176976518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176976518">(Sep 30 2019 at 21:28)</a>:</h4>
<p>or...</p>



<a name="176976529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176976529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176976529">(Sep 30 2019 at 21:28)</a>:</h4>
<p>just take a look at the whole of the last commit</p>



<a name="176976535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176976535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176976535">(Sep 30 2019 at 21:29)</a>:</h4>
<p>I think it's all new stuff</p>



<a name="176976969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176976969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176976969">(Sep 30 2019 at 21:34)</a>:</h4>
<p>ok</p>



<a name="176977218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977218">(Sep 30 2019 at 21:38)</a>:</h4>
<p>something about the names feels wrong to me here</p>



<a name="176977326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977326">(Sep 30 2019 at 21:40)</a>:</h4>
<p>names of the fns? sure, suggest new ones, by all means</p>



<a name="176977344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977344">(Sep 30 2019 at 21:41)</a>:</h4>
<p>I'm confused about <code> coerce_unsized_operand</code></p>



<a name="176977348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977348">(Sep 30 2019 at 21:41)</a>:</h4>
<p>the main thing I'm concerned about right now is the functionality though</p>



<a name="176977350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977350">(Sep 30 2019 at 21:41)</a>:</h4>
<p>hmm</p>



<a name="176977372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977372">(Sep 30 2019 at 21:41)</a>:</h4>
<p>there's no such fn?</p>



<a name="176977421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977421">(Sep 30 2019 at 21:42)</a>:</h4>
<p>indeed, there is no such fn</p>



<a name="176977424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977424">(Sep 30 2019 at 21:42)</a>:</h4>
<p>are you looking at an old commit by chance?</p>



<a name="176977429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977429">(Sep 30 2019 at 21:42)</a>:</h4>
<p>that is what is confusing me :)</p>



<a name="176977432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977432">(Sep 30 2019 at 21:42)</a>:</h4>
<p>no, it's commented out code</p>



<a name="176977436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977436">(Sep 30 2019 at 21:42)</a>:</h4>
<p>where did it come from?</p>



<a name="176977450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977450">(Sep 30 2019 at 21:42)</a>:</h4>
<p>ah</p>



<a name="176977499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977499">(Sep 30 2019 at 21:42)</a>:</h4>
<p>I don't even see it commented out</p>



<a name="176977501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977501">(Sep 30 2019 at 21:42)</a>:</h4>
<p>grep returns nothing hmm!</p>



<a name="176977520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977520">(Sep 30 2019 at 21:43)</a>:</h4>
<p>well anyway not imp't</p>



<a name="176977524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977524">(Sep 30 2019 at 21:43)</a>:</h4>
<p>to answer your question</p>



<a name="176977564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977564">(Sep 30 2019 at 21:43)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="n">info</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">info</span><span class="p">;</span><span class="w"> </span><span class="c1">// FIXME: what should go here?</span>
</pre></div>


<p>that question, I mean</p>



<a name="176977610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977610">(Sep 30 2019 at 21:44)</a>:</h4>
<p>yeah</p>



<a name="176977614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977614">(Sep 30 2019 at 21:44)</a>:</h4>
<p>I thnk that the setup is sort of off</p>



<a name="176977621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977621">(Sep 30 2019 at 21:44)</a>:</h4>
<p>okay it may well be</p>



<a name="176977626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977626">(Sep 30 2019 at 21:44)</a>:</h4>
<p>I'm really a newb when it comes to codegen!</p>



<a name="176977641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977641">(Sep 30 2019 at 21:44)</a>:</h4>
<p>just been looking at examples in other places to try to learn</p>



<a name="176977664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977664">(Sep 30 2019 at 21:45)</a>:</h4>
<p>basically I think the <code>OperandValue</code> you want to return is to load from <code>dst_scratch</code></p>



<a name="176977672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977672">(Sep 30 2019 at 21:45)</a>:</h4>
<p>right, exactly...</p>



<a name="176977675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977675">(Sep 30 2019 at 21:45)</a>:</h4>
<p>but I'm wondering now how that would interact with storage-dea</p>



<a name="176977682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977682">(Sep 30 2019 at 21:45)</a>:</h4>
<p>ah yes</p>



<a name="176977685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977685">(Sep 30 2019 at 21:45)</a>:</h4>
<p>I was wondering about that</p>



<a name="176977696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977696">(Sep 30 2019 at 21:45)</a>:</h4>
<p>whether it invalidates the operand even if I do storage-dead <em>after</em> fetching the operand value</p>



<a name="176977787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977787">(Sep 30 2019 at 21:46)</a>:</h4>
<p>if not, maybe I can just do <code>OperandValue::Pair(dst_scratch.llval, dst_scratch.llextra)</code> for that line? though that seems suspect too?</p>



<a name="176977931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977931">(Sep 30 2019 at 21:48)</a>:</h4>
<p>I think that's invalid, yes</p>



<a name="176977944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977944">(Sep 30 2019 at 21:48)</a>:</h4>
<p>(BTW, I pushed again. no major changes, just fixed some build errors due to copy &amp; paste coding...)</p>



<a name="176977946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977946">(Sep 30 2019 at 21:49)</a>:</h4>
<p>hmm</p>



<a name="176977954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977954">(Sep 30 2019 at 21:49)</a>:</h4>
<p>so I feel like, to go this way, you really don't want to be returning an operand</p>



<a name="176977962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977962">(Sep 30 2019 at 21:49)</a>:</h4>
<p>you want to be given a dest</p>



<a name="176977970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977970">(Sep 30 2019 at 21:49)</a>:</h4>
<p>looking a bit further out</p>



<a name="176977979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977979">(Sep 30 2019 at 21:49)</a>:</h4>
<p>at the callers of this function</p>



<a name="176977984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977984">(Sep 30 2019 at 21:49)</a>:</h4>
<p>one of them has a destination</p>



<a name="176977986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977986">(Sep 30 2019 at 21:49)</a>:</h4>
<p>possibly</p>



<a name="176977988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176977988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176977988">(Sep 30 2019 at 21:49)</a>:</h4>
<p>the other does not</p>



<a name="176978000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978000">(Sep 30 2019 at 21:49)</a>:</h4>
<p>however, the other caller comes from a statement assign</p>



<a name="176978010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978010">(Sep 30 2019 at 21:49)</a>:</h4>
<p>in particular we have some logic for cases like <code>x = foo</code> where we tried to avoid an alloca for <code>x</code></p>



<a name="176978021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978021">(Sep 30 2019 at 21:50)</a>:</h4>
<p>if <code>x</code> has a "sufficiently complicated" type we'll create one</p>



<a name="176978060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978060">(Sep 30 2019 at 21:50)</a>:</h4>
<p>the question is: can <code>coerce_ptr_unsized</code> even get called with an <code>op</code> that has an ADT, in practice? I presume the answer is yes.</p>



<a name="176978066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978066">(Sep 30 2019 at 21:50)</a>:</h4>
<p>basically a non-immediate type (and we include pairs in that case)</p>



<a name="176978077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978077">(Sep 30 2019 at 21:50)</a>:</h4>
<blockquote>
<p>the question is: can <code>coerce_ptr_unsized</code> even get called with an <code>op</code> that has an ADT, in practice? I presume the answer is yes.</p>
</blockquote>
<p>I think you kind of want to split out the path where the case is "yes" from the case where it is "no"</p>



<a name="176978079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978079">(Sep 30 2019 at 21:50)</a>:</h4>
<p>is what I'm getting at</p>



<a name="176978082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978082">(Sep 30 2019 at 21:50)</a>:</h4>
<p>it's only called a) recursively b) by <code>cosdegen_rvalue_operand</code></p>



<a name="176978101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978101">(Sep 30 2019 at 21:51)</a>:</h4>
<p>in particular, <code>codegen_rvalue_operand</code> is invoked from the assignment code I was talking about above</p>



<a name="176978107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978107">(Sep 30 2019 at 21:51)</a>:</h4>
<p>which itself needs to spit out  an <code>OperandRef</code></p>



<a name="176978110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978110">(Sep 30 2019 at 21:51)</a>:</h4>
<p>not assign to a <code>PlaceRef</code></p>



<a name="176978112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978112">(Sep 30 2019 at 21:51)</a>:</h4>
<p>hmm</p>



<a name="176978181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978181">(Sep 30 2019 at 21:52)</a>:</h4>
<p>notice that <code>codegen_rvalue_operand</code> already has some logic that assumes this</p>



<a name="176978182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978182">(Sep 30 2019 at 21:52)</a>:</h4>
<p>e.g.</p>



<a name="176978183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978183">(Sep 30 2019 at 21:52)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">            </span><span class="n">mir</span>::<span class="n">Rvalue</span>::<span class="n">Repeat</span><span class="p">(..)</span><span class="w"> </span><span class="o">|</span><span class="w"></span>
<span class="w">            </span><span class="n">mir</span>::<span class="n">Rvalue</span>::<span class="n">Aggregate</span><span class="p">(..)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="c1">// According to `rvalue_creates_operand`, only ZST</span>
<span class="w">                </span><span class="c1">// aggregate rvalues are allowed to be operands.</span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rvalue</span><span class="p">.</span><span class="n">ty</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">mir</span><span class="p">,</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">tcx</span><span class="p">());</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">operand</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">OperandRef</span>::<span class="n">new_zst</span><span class="p">(</span><span class="w"></span>
<span class="w">                    </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">bx</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">layout_of</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">monomorphize</span><span class="p">(</span><span class="o">&amp;</span><span class="n">ty</span><span class="p">)),</span><span class="w"></span>
<span class="w">                </span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="p">(</span><span class="n">bx</span><span class="p">,</span><span class="w"> </span><span class="n">operand</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="176978192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978192">(Sep 30 2019 at 21:52)</a>:</h4>
<p>i.e., it assumes it <em>can</em> be invoked with a <code>Foo { ... }</code> operand that constructs a struct, but only if that struct is a ZST</p>



<a name="176978212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978212">(Sep 30 2019 at 21:52)</a>:</h4>
<p>now I don't think this means you can't have an ADT necessarily</p>



<a name="176978217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978217">(Sep 30 2019 at 21:52)</a>:</h4>
<p>hmm</p>



<a name="176978221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978221">(Sep 30 2019 at 21:52)</a>:</h4>
<p>it's just that your ADT must be represented by a (ptr, info) pair</p>



<a name="176978224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978224">(Sep 30 2019 at 21:53)</a>:</h4>
<p>and not some more general structure</p>



<a name="176978231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978231">(Sep 30 2019 at 21:53)</a>:</h4>
<p>I'm not 100% sure about that</p>



<a name="176978235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978235">(Sep 30 2019 at 21:53)</a>:</h4>
<p>you could test with e.g. <code>Arc</code></p>



<a name="176978247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978247">(Sep 30 2019 at 21:53)</a>:</h4>
<p>yeah, so it's already a fat pointer to an ADT?</p>



<a name="176978256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978256">(Sep 30 2019 at 21:53)</a>:</h4>
<p>but the decision of whether to use an alloca for a type is made in the <code>non_ssa_locals</code> function</p>



<a name="176978265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978265">(Sep 30 2019 at 21:53)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">       </span><span class="kd">let</span><span class="w"> </span><span class="n">layout</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">fx</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">spanned_layout_of</span><span class="p">(</span><span class="n">ty</span><span class="p">,</span><span class="w"> </span><span class="n">span</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="n">fx</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">is_backend_immediate</span><span class="p">(</span><span class="n">layout</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// These sorts of types are immediates that we can store</span>
<span class="w">            </span><span class="c1">// in an Value without an alloca.</span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">fx</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">is_backend_scalar_pair</span><span class="p">(</span><span class="n">layout</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// We allow pairs and uses of any of their 2 fields.</span>
</pre></div>



<a name="176978267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978267">(Sep 30 2019 at 21:53)</a>:</h4>
<p>and it seems to be based on the <em>layout</em></p>



<a name="176978270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978270">(Sep 30 2019 at 21:53)</a>:</h4>
<p>(which makes sense)</p>



<a name="176978272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978272">(Sep 30 2019 at 21:54)</a>:</h4>
<blockquote>
<p>yeah, so it's already a fat pointer to an ADT?</p>
</blockquote>
<p>no</p>



<a name="176978317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978317">(Sep 30 2019 at 21:54)</a>:</h4>
<p>well I don't know what "fat pointer to an ADT means"</p>



<a name="176978339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978339">(Sep 30 2019 at 21:54)</a>:</h4>
<p>but e.g. an <code>Arc&lt;dyn Debug&gt;</code> would be represented (I think) by a <code>(ptr, vtable)</code> pair where the <code>ptr</code> is the <code>Arc&lt;_&gt;</code> pointer --- i.e., it's internal pointer to some shared box with a ref count</p>



<a name="176978341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978341">(Sep 30 2019 at 21:54)</a>:</h4>
<p>e.g. <code>&amp;dyn FooStruct</code> or <code>Box&lt;dyn FooStruct&gt;</code>?</p>



<a name="176978361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978361">(Sep 30 2019 at 21:55)</a>:</h4>
<p><code>dyn FooStruct</code> is a contradiction, no?</p>



<a name="176978363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978363">(Sep 30 2019 at 21:55)</a>:</h4>
<p>okay</p>



<a name="176978373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978373">(Sep 30 2019 at 21:55)</a>:</h4>
<p>ughh</p>



<a name="176978379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978379">(Sep 30 2019 at 21:55)</a>:</h4>
<p>I'm tired, sorry</p>



<a name="176978381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978381">(Sep 30 2019 at 21:55)</a>:</h4>
<p>long day</p>



<a name="176978383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978383">(Sep 30 2019 at 21:55)</a>:</h4>
<p>basically if you had a <code>Arc&lt;T&gt;</code>, it would be represented by (in C terms) a <code>*const T</code></p>



<a name="176978388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978388">(Sep 30 2019 at 21:55)</a>:</h4>
<p>actually a <code>*const ArcData&lt;T&gt;</code> or something</p>



<a name="176978392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978392">(Sep 30 2019 at 21:55)</a>:</h4>
<p>and so the layout in this case would be a <code>(*const ArcLayout&lt;T&gt;, vtable)</code></p>



<a name="176978401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978401">(Sep 30 2019 at 21:56)</a>:</h4>
<p>I guess that's C terms but Rust syntax :) or .. something</p>



<a name="176978447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978447">(Sep 30 2019 at 21:56)</a>:</h4>
<p>guess I was thinking <code>&amp;dyn Trait</code> where <code>FooStruct: Trait</code></p>



<a name="176978448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978448">(Sep 30 2019 at 21:56)</a>:</h4>
<p>point is, the <code>Arc&lt;T&gt;</code> struct is really just a pointer</p>



<a name="176978455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978455">(Sep 30 2019 at 21:56)</a>:</h4>
<p>okay</p>



<a name="176978466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978466">(Sep 30 2019 at 21:56)</a>:</h4>
<p>anyway the reason I mention all that is</p>



<a name="176978472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978472">(Sep 30 2019 at 21:56)</a>:</h4>
<p>the logic that "spills" to temporary stack slots is intended for more complex cases</p>



<a name="176978475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978475">(Sep 30 2019 at 21:56)</a>:</h4>
<p>in that case... wouldn't it just be handled by one of the previous two arms of the match?</p>



<a name="176978477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978477">(Sep 30 2019 at 21:56)</a>:</h4>
<p>where the struct has arbitray fields and things</p>



<a name="176978497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978497">(Sep 30 2019 at 21:57)</a>:</h4>
<blockquote>
<p>in that case... wouldn't it just be handled by one of the previous two arms of the match?</p>
</blockquote>
<p>no, because the match is matching on it's <strong>Rust type</strong></p>



<a name="176978512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978512">(Sep 30 2019 at 21:57)</a>:</h4>
<p>however</p>



<a name="176978526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978526">(Sep 30 2019 at 21:57)</a>:</h4>
<p>right, not its LLVM type...</p>



<a name="176978531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978531">(Sep 30 2019 at 21:57)</a>:</h4>
<p>makes sense</p>



<a name="176978593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978593">(Sep 30 2019 at 21:58)</a>:</h4>
<p>this logic here:</p>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="p">(</span><span class="o">&amp;</span><span class="n">ty</span>::<span class="n">Adt</span><span class="p">(</span><span class="n">def_a</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="p">),</span><span class="w"> </span><span class="o">&amp;</span><span class="n">ty</span>::<span class="n">Adt</span><span class="p">(</span><span class="n">def_b</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="p">))</span><span class="w"></span>
<span class="w">                    </span><span class="k">if</span><span class="w"> </span><span class="n">def_a</span><span class="p">.</span><span class="n">is_box</span><span class="p">()</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="n">def_b</span><span class="p">.</span><span class="n">is_box</span><span class="p">()</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"></span>
<span class="w">                </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">unsized_info</span><span class="p">(</span><span class="n">bx</span><span class="p">,</span><span class="w"> </span><span class="n">src</span><span class="p">.</span><span class="n">ty</span><span class="p">.</span><span class="n">boxed_ty</span><span class="p">(),</span><span class="w"> </span><span class="n">dst</span><span class="p">.</span><span class="n">ty</span><span class="p">.</span><span class="n">boxed_ty</span><span class="p">(),</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">info</span><span class="p">))</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>is .. probably what we want, <em>more or less</em>, except that it's hardcoded to box</p>



<a name="176978648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978648">(Sep 30 2019 at 21:59)</a>:</h4>
<p>do we want something more like the final match arm in <code>coerce_unsized_into</code> then?</p>



<a name="176978653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978653">(Sep 30 2019 at 21:59)</a>:</h4>
<p>don't know how that can be adapted for operands and not places though</p>



<a name="176978685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978685">(Sep 30 2019 at 21:59)</a>:</h4>
<p>heh man this is annoying</p>



<a name="176978726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978726">(Sep 30 2019 at 22:00)</a>:</h4>
<p>so let's first just try to get it <em>working</em></p>



<a name="176978742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978742">(Sep 30 2019 at 22:00)</a>:</h4>
<p>then we'll worry about making it a bit more efficient</p>



<a name="176978743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978743">(Sep 30 2019 at 22:00)</a>:</h4>
<p>yep</p>



<a name="176978745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978745">(Sep 30 2019 at 22:00)</a>:</h4>
<p>at least the simple case is working now :-P</p>



<a name="176978750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978750">(Sep 30 2019 at 22:00)</a>:</h4>
<p>oh wait, wait</p>



<a name="176978751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978751">(Sep 30 2019 at 22:00)</a>:</h4>
<p>just not upcasting things like Arc</p>



<a name="176978754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978754">(Sep 30 2019 at 22:00)</a>:</h4>
<p>I gues...</p>



<a name="176978755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978755">(Sep 30 2019 at 22:00)</a>:</h4>
<p>ok ok so there are <em>two</em> callers of <code>coerce_ptr_unsized</code> <em>but</em></p>



<a name="176978760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978760">(Sep 30 2019 at 22:00)</a>:</h4>
<p>both of them are assuming that the source operand is either a pointer or a (pointer, info) pair</p>



<a name="176978769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978769">(Sep 30 2019 at 22:01)</a>:</h4>
<p>in the case of <code>coerce_unsized_into</code>, that's because it's already done the logic of matching the fields of the adts</p>



<a name="176978774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978774">(Sep 30 2019 at 22:01)</a>:</h4>
<p>yes that's true</p>



<a name="176978778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978778">(Sep 30 2019 at 22:01)</a>:</h4>
<p>but the second?</p>



<a name="176978782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978782">(Sep 30 2019 at 22:01)</a>:</h4>
<p>I was worried about that one</p>



<a name="176978785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978785">(Sep 30 2019 at 22:01)</a>:</h4>
<p>in the case of the rvalue coercion fn, that's because of the limits on local variables (more complex type would be spilled to alloca)</p>



<a name="176978842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978842">(Sep 30 2019 at 22:02)</a>:</h4>
<p>oh. so you're saying <code>codegen_rvalue_operand</code> would never be called for complex ADTs even?</p>



<a name="176978895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978895">(Sep 30 2019 at 22:03)</a>:</h4>
<p>correct</p>



<a name="176978900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978900">(Sep 30 2019 at 22:03)</a>:</h4>
<p>we would call <code>codegen_rvalue_into</code> or something like that</p>



<a name="176978901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978901">(Sep 30 2019 at 22:03)</a>:</h4>
<p>cool</p>



<a name="176978910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978910">(Sep 30 2019 at 22:03)</a>:</h4>
<p>or just <code>bug!</code> out?</p>



<a name="176978914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978914">(Sep 30 2019 at 22:03)</a>:</h4>
<p>up to you</p>



<a name="176978918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978918">(Sep 30 2019 at 22:03)</a>:</h4>
<p>no I mean</p>



<a name="176978921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978921">(Sep 30 2019 at 22:03)</a>:</h4>
<blockquote>
<p>oh. so you're saying <code>codegen_rvalue_operand</code> would never be called for complex ADTs even?</p>
</blockquote>
<p>it is a bug to call this for a more complex ADT</p>



<a name="176978928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978928">(Sep 30 2019 at 22:03)</a>:</h4>
<p>the caller ought to have invoked one of the into variants</p>



<a name="176978932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978932">(Sep 30 2019 at 22:03)</a>:</h4>
<p>so I think what you want to do in <code>coerce_ptr_unsized</code></p>



<a name="176978991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978991">(Sep 30 2019 at 22:04)</a>:</h4>
<p>you basically want to invoke <code>unsized_info</code>, but the trick is figuring out what type to invoke it <em>with</em></p>



<a name="176978996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978996">(Sep 30 2019 at 22:04)</a>:</h4>
<p>then isn't it a bug to call <code>coerce_ptr_unsized</code> on a more complex ADT likewise, since you gave the only two call sites above?</p>



<a name="176978999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176978999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176978999">(Sep 30 2019 at 22:04)</a>:</h4>
<p>okay...</p>



<a name="176979011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979011">(Sep 30 2019 at 22:04)</a>:</h4>
<p>ah wait</p>



<a name="176979038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979038">(Sep 30 2019 at 22:05)</a>:</h4>
<p>I <strong>think</strong> maybe this will work?</p>



<a name="176979039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979039">(Sep 30 2019 at 22:05)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="p">(</span><span class="o">&amp;</span><span class="n">ty</span>::<span class="n">Adt</span><span class="p">(</span><span class="n">def_a</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="p">),</span><span class="w"> </span><span class="o">&amp;</span><span class="n">ty</span>::<span class="n">Adt</span><span class="p">(</span><span class="n">def_b</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="n">def_a</span><span class="p">,</span><span class="w"> </span><span class="n">def_b</span><span class="p">);</span><span class="w"></span>
<span class="w">                    </span><span class="n">unsized_info</span><span class="p">(</span><span class="n">bx</span><span class="p">,</span><span class="w"> </span><span class="n">src</span><span class="p">.</span><span class="n">ty</span><span class="p">,</span><span class="w"> </span><span class="n">dst</span><span class="p">.</span><span class="n">ty</span><span class="p">,</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">info</span><span class="p">))</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="176979082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979082">(Sep 30 2019 at 22:06)</a>:</h4>
<p>in particular, <code>unsized_info</code> seems to already expect two instance of the same ADT, and it knows to walk their fields in lockstep</p>



<a name="176979108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979108">(Sep 30 2019 at 22:06)</a>:</h4>
<p>(the code for <code>box</code> might be similarly simplified and mergd into this arm, actually)</p>



<a name="176979124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979124">(Sep 30 2019 at 22:06)</a>:</h4>
<p>line 131 then?</p>



<a name="176979125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979125">(Sep 30 2019 at 22:06)</a>:</h4>
<p>of that file</p>



<a name="176979140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979140">(Sep 30 2019 at 22:07)</a>:</h4>
<p>I pushed a commit to your branch</p>



<a name="176979143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979143">(Sep 30 2019 at 22:07)</a>:</h4>
<p>not sure if it works</p>



<a name="176979146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979146">(Sep 30 2019 at 22:07)</a>:</h4>
<p>but I got to run</p>



<a name="176979148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979148">(Sep 30 2019 at 22:07)</a>:</h4>
<p>I <em>think</em> it may be correct</p>



<a name="176979162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979162">(Sep 30 2019 at 22:07)</a>:</h4>
<p>in which case I <em>think</em> the match arm I just modified and the match arm before it can be mergd</p>



<a name="176979169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979169">(Sep 30 2019 at 22:07)</a>:</h4>
<p>okay thanks!</p>



<a name="176979172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979172">(Sep 30 2019 at 22:07)</a>:</h4>
<p>sounds good</p>



<a name="176979176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979176">(Sep 30 2019 at 22:07)</a>:</h4>
<p>makes sense actually</p>



<a name="176979215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979215">(Sep 30 2019 at 22:08)</a>:</h4>
<p>I'll see if it gets rid of the bootstrap error btw, which is: <a href="https://gist.github.com/e20f1817eb2ced1ec25ba706f8a9c31a" target="_blank" title="https://gist.github.com/e20f1817eb2ced1ec25ba706f8a9c31a">https://gist.github.com/e20f1817eb2ced1ec25ba706f8a9c31a</a></p>



<a name="176979231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979231">(Sep 30 2019 at 22:08)</a>:</h4>
<p>cool, I'm doing a local build too</p>



<a name="176979239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979239">(Sep 30 2019 at 22:08)</a>:</h4>
<p>(the box code is taking <code>Box&lt;T&gt; -&gt; Box&lt;U&gt;</code> coercion and invoking that helper with <code>T, U</code>...</p>



<a name="176979240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979240">(Sep 30 2019 at 22:08)</a>:</h4>
<p>it's an LLVM assertion issue with the bootstrap, so that's a bit disconcerting, but oh well..</p>



<a name="176979245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979245">(Sep 30 2019 at 22:08)</a>:</h4>
<p>but from what I can see, the helper would deal just fine with <code>Box</code> arguments)</p>



<a name="176979248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979248">(Sep 30 2019 at 22:08)</a>:</h4>
<p>with the bootstrap*</p>



<a name="176979263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979263">(Sep 30 2019 at 22:09)</a>:</h4>
<p>cool</p>



<a name="176979268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979268">(Sep 30 2019 at 22:09)</a>:</h4>
<blockquote>
<p>cool, I'm doing a local build too</p>
</blockquote>
<p>I'm just doing a <code>./x.py build -i</code> so I guess i'll find out</p>



<a name="176979276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979276">(Sep 30 2019 at 22:09)</a>:</h4>
<p>yeah heh</p>



<a name="176979357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979357">(Sep 30 2019 at 22:10)</a>:</h4>
<p>thanks for working over this with me. if you could look at what I wrote about the REPL PRs / compiler team meetings and whatnot in your own time, and let me know, that would be great. a synchronous chat about that is less important probably!</p>



<a name="176979422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979422">(Sep 30 2019 at 22:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> anyway, see you later. I'm off for now too.</p>



<a name="176979481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979481">(Sep 30 2019 at 22:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> oh, and I don't think you pushed FYI.</p>



<a name="176979493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979493">(Sep 30 2019 at 22:12)</a>:</h4>
<p>oh it got rejected</p>



<a name="176979508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979508">(Sep 30 2019 at 22:12)</a>:</h4>
<p>not sure why</p>



<a name="176979511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979511">(Sep 30 2019 at 22:13)</a>:</h4>
<p>sorry. probably because of my fixing-build-errors force-push while we were chatting</p>



<a name="176979519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979519">(Sep 30 2019 at 22:13)</a>:</h4>
<p>ok</p>



<a name="176979522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979522">(Sep 30 2019 at 22:13)</a>:</h4>
<p>I'll rebase</p>



<a name="176979532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979532">(Sep 30 2019 at 22:13)</a>:</h4>
<p>or force push, and I can rebase. don't mind much.</p>



<a name="176979541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979541">(Sep 30 2019 at 22:13)</a>:</h4>
<p>cheers!</p>



<a name="176979602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979602">(Sep 30 2019 at 22:14)</a>:</h4>
<p>done</p>



<a name="176979755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176979755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176979755">(Sep 30 2019 at 22:16)</a>:</h4>
<p>(I get a crash trying to bootstrap =)</p>



<a name="176983453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/176983453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#176983453">(Sep 30 2019 at 23:18)</a>:</h4>
<p>heh not too surprised</p>



<a name="177077340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177077340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177077340">(Oct 01 2019 at 17:21)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="177077347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177077347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177077347">(Oct 01 2019 at 17:21)</a>:</h4>
<p>so..</p>



<a name="177077351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177077351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177077351">(Oct 01 2019 at 17:21)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">bar</span>: <span class="nc">Arc</span><span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Bar</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Arc</span>::<span class="n">new</span><span class="p">(</span><span class="mi">42</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span>: <span class="nc">Arc</span><span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Foo</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bar</span><span class="p">;</span><span class="w"></span>
</pre></div>



<a name="177077364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177077364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177077364">(Oct 01 2019 at 17:21)</a>:</h4>
<p>that should work,right?</p>



<a name="177077430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177077430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177077430">(Oct 01 2019 at 17:22)</a>:</h4>
<p>but I get</p>
<div class="codehilite"><pre><span></span>error: internal compiler error: src/librustc_codegen_ssa/base.rs:164: unsized_info: invalid unsizing std::marker::PhantomData&lt;dyn Bar&gt; -&gt; std::marker::PhantomData&lt;dyn Foo&gt;
</pre></div>



<a name="177077467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177077467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177077467">(Oct 01 2019 at 17:22)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> let me know if you have any ideas (about this or the LLVM assertion bootstrapping issue)</p>



<a name="177078207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177078207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177078207">(Oct 01 2019 at 17:31)</a>:</h4>
<p>there may be an easy fix to that actually... let's see</p>



<a name="177080743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177080743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177080743">(Oct 01 2019 at 17:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> added this to <code>unsized_info</code>, and the cast "works", but it segfaults when I try to print <code>foo</code>:</p>
<div class="codehilite"><pre><span></span>        (&amp;ty::Adt(def_a, _), &amp;ty::Adt(def_b, _))
            if def_a.is_phantom_data() &amp;&amp; def_b.is_phantom_data() =&gt;
        {
            old_info.expect(&quot;unsized_info: missing old info&quot;)
        }
</pre></div>



<a name="177243509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177243509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177243509">(Oct 03 2019 at 13:26)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> that hack seems ok for now, let's revisit that problem</p>



<a name="177243514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177243514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177243514">(Oct 03 2019 at 13:26)</a>:</h4>
<p>we gotta figure out the cause of these segfaults though</p>



<a name="177259532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177259532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177259532">(Oct 03 2019 at 16:09)</a>:</h4>
<p>sure</p>



<a name="177259571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177259571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177259571">(Oct 03 2019 at 16:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I don't know if that hack is causing the segfault... but yeah the segfault there and the weird bootstrapping LLVM error... that's beyond me!</p>



<a name="177367611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177367611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177367611">(Oct 04 2019 at 18:41)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I don't see any LLVM error when bootstrapping</p>



<a name="177367622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177367622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177367622">(Oct 04 2019 at 18:41)</a>:</h4>
<p>I guess maybe it doesn't get that far</p>



<a name="177367627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177367627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177367627">(Oct 04 2019 at 18:41)</a>:</h4>
<p>but those are usually good hint :)</p>



<a name="177367752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177367752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177367752">(Oct 04 2019 at 18:42)</a>:</h4>
<p>let me try rebuilding with verify-llvm-ir=true I guess</p>



<a name="177372307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177372307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177372307">(Oct 04 2019 at 19:38)</a>:</h4>
<p>oh interesting. maybe it was a consequence of <code>--keep-stage 0</code>?</p>



<a name="177372356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177372356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177372356">(Oct 04 2019 at 19:39)</a>:</h4>
<p>or actually, of <code>-i</code></p>



<a name="177372362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177372362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177372362">(Oct 04 2019 at 19:39)</a>:</h4>
<p>and not removing the LLVM artefacts</p>



<a name="177372387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177372387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177372387">(Oct 04 2019 at 19:39)</a>:</h4>
<p>you saw the segfault though yes?</p>



<a name="177372394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177372394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177372394">(Oct 04 2019 at 19:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="177374573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374573">(Oct 04 2019 at 20:05)</a>:</h4>
<p>I do see a segfault</p>



<a name="177374585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374585">(Oct 04 2019 at 20:05)</a>:</h4>
<p>I'm trying to reproduce it in some way in a debugger</p>



<a name="177374590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374590">(Oct 04 2019 at 20:05)</a>:</h4>
<p>and failing</p>



<a name="177374643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374643">(Oct 04 2019 at 20:06)</a>:</h4>
<p>like, I literally cannot figure out what command to run  :)</p>



<a name="177374658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374658">(Oct 04 2019 at 20:06)</a>:</h4>
<p>the last thing I see is</p>



<a name="177374666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374666">(Oct 04 2019 at 20:06)</a>:</h4>
<div class="codehilite"><pre><span></span>     Running `/home/nmatsakis/versioned/rust-2/build/bootstrap/debug/rustc --edition=2018 --crate-name core
</pre></div>



<a name="177374671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374671">(Oct 04 2019 at 20:06)</a>:</h4>
<p>and the "boostrap rustc" is kind of impossible to run from outside x.py in my experience :)</p>



<a name="177374867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374867">(Oct 04 2019 at 20:09)</a>:</h4>
<p>one can add --on-fail=env to print the environment IIRC</p>



<a name="177374957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177374957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177374957">(Oct 04 2019 at 20:10)</a>:</h4>
<p>likely that --on-fail=bash might work to launch a debugger from there but I've never tried that</p>



<a name="177375709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375709">(Oct 04 2019 at 20:20)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> whenever you see bootstrap rustc you should be able to easily replace it with the stage1/bin/rustc or so and that would generally just work</p>



<a name="177375726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375726">(Oct 04 2019 at 20:20)</a>:</h4>
<p>you might need to throw in a few env variables, but most of the time you can just SOME_ENV=foo and it'll be fine</p>



<a name="177375750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375750">(Oct 04 2019 at 20:21)</a>:</h4>
<p>lately i've foudn that is not true</p>



<a name="177375751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375751">(Oct 04 2019 at 20:21)</a>:</h4>
<p>that used to be true</p>



<a name="177375756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375756">(Oct 04 2019 at 20:21)</a>:</h4>
<p>I'll give it a try though, maybe I'm wrong</p>



<a name="177375768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375768">(Oct 04 2019 at 20:21)</a>:</h4>
<blockquote>
<p>likely that --on-fail=bash might work to launch a debugger from there but I've never tried that</p>
</blockquote>
<p>that used to work but it stopped working for me at some point</p>



<a name="177375871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375871">(Oct 04 2019 at 20:23)</a>:</h4>
<p>yeah I now remember there's an issue saying it doesn't work anymore :/</p>



<a name="177375942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375942">(Oct 04 2019 at 20:24)</a>:</h4>
<p>ah, good news</p>



<a name="177375948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375948">(Oct 04 2019 at 20:24)</a>:</h4>
<p>for some reason I am now seeing the actual rustc: command output...</p>



<a name="177375965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177375965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177375965">(Oct 04 2019 at 20:24)</a>:</h4>
<div class="codehilite"><pre><span></span>rustc command: &quot;LD_LIBRARY_PATH&quot;=&quot;/home/nmatsakis/versioned/rust-2/build/x86_64-unknown-linux-gnu/stage1/lib:/home/nmatsakis/versioned/rust-2/build/x86_64-unknown-linux-gnu/stage1-std/release/deps:/home/nma\
tsakis/versioned/rust-2/build/x86_64-unknown-linux-gnu/stage0/lib&quot;
</pre></div>


<p>copying and pasting <em>that</em> usually works for me...</p>



<a name="177376003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376003">(Oct 04 2019 at 20:25)</a>:</h4>
<p>hm strange.. I would not expect that to be the case.</p>



<a name="177376010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376010">(Oct 04 2019 at 20:25)</a>:</h4>
<p>maybe for stage 0 but not stage 1</p>



<a name="177376077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376077">(Oct 04 2019 at 20:26)</a>:</h4>
<p>ok <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> so I am seeing this</p>
<div class="codehilite"><pre><span></span>Invalid InsertValueInst operands!
  %38 = insertvalue { {}*, [3 x i64]* } %37, i64* getelementptr inbounds ([3 x i64], [3 x i64]* bitcast ({ void (%&quot;fmt::builders::PadAdapter&quot;*)*, i64, i64, i1 (%&quot;fmt::builders::PadAdapter&quot;*, [0 x i8]*, i64)\
*, i1 (%&quot;fmt::builders::PadAdapter&quot;*, i32)*, i1 (%&quot;fmt::builders::PadAdapter&quot;*, %&quot;fmt::Arguments&quot;*)* }* @3 to [3 x i64]*), i32 0, i32 0), 1, !dbg !189
in function _ZN4core3fmt8builders10PadAdapter4wrap28_$u7b$$u7b$closure$u7d$$u7d$17he99dacb16de69f1eE
LLVM ERROR: Broken function found, compilation aborted!
``

now that I rebuilt with llvm assertions
</pre></div>



<a name="177376087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376087">(Oct 04 2019 at 20:26)</a>:</h4>
<p>although hmm</p>



<a name="177376235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376235">(Oct 04 2019 at 20:28)</a>:</h4>
<blockquote>
<p>I do see a segfault</p>
</blockquote>
<p>for the <code>Arc</code> case, <span class="user-mention" data-user-id="116009">@nikomatsakis</span> ?</p>



<a name="177376266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376266">(Oct 04 2019 at 20:29)</a>:</h4>
<p>ah righg</p>



<a name="177376291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376291">(Oct 04 2019 at 20:29)</a>:</h4>
<p>so this looks like a</p>



<a name="177376300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376300">(Oct 04 2019 at 20:30)</a>:</h4>
<p><code>&amp;mut dyn Write -&gt; &amp;mut dyn Write</code> coercion</p>



<a name="177376341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376341">(Oct 04 2019 at 20:30)</a>:</h4>
<p>going wrong somehow ;)</p>



<a name="177376352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376352">(Oct 04 2019 at 20:30)</a>:</h4>
<p>hmm</p>



<a name="177376358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376358">(Oct 04 2019 at 20:30)</a>:</h4>
<p>how is that a coercion even though?</p>



<a name="177376364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376364">(Oct 04 2019 at 20:30)</a>:</h4>
<p>the same type</p>



<a name="177376368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376368">(Oct 04 2019 at 20:30)</a>:</h4>
<p>it is</p>



<a name="177376371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376371">(Oct 04 2019 at 20:30)</a>:</h4>
<p>because of lifetime bounds</p>



<a name="177376375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376375">(Oct 04 2019 at 20:30)</a>:</h4>
<p>oh</p>



<a name="177376376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376376">(Oct 04 2019 at 20:30)</a>:</h4>
<p>duh</p>



<a name="177376406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376406">(Oct 04 2019 at 20:31)</a>:</h4>
<p>so... maybe I removed too much of the previous code? hmm</p>



<a name="177376432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376432">(Oct 04 2019 at 20:31)</a>:</h4>
<p>honestly I'm having a hard time even parsing that type ;)</p>



<a name="177376437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376437">(Oct 04 2019 at 20:31)</a>:</h4>
<p>which <em>only</em> had to deal with lifetime bound coercions for trait objects</p>



<a name="177376439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376439">(Oct 04 2019 at 20:31)</a>:</h4>
<div class="codehilite"><pre><span></span>  %38 = insertvalue { {}*, [3 x i64]* } %37, i64* getelementptr inbounds ([3 x i64], [3 x i64]* bitcast ({ void (%&quot;fmt::builders::PadAdapter&quot;*)*, i64, i64, i1 (%&quot;fmt::builders::PadAdapter&quot;*, [0 x i8]*, i64)\
*, i1 (%&quot;fmt::builders::PadAdapter&quot;*, i32)*, i1 (%&quot;fmt::builders::PadAdapter&quot;*, %&quot;fmt::Arguments&quot;*)* }* @3 to [3 x i64]*), i32 0, i32 0), 1, !dbg !189
</pre></div>



<a name="177376443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376443">(Oct 04 2019 at 20:31)</a>:</h4>
<p>since auto-traits were basically irrelevant</p>



<a name="177376454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376454">(Oct 04 2019 at 20:31)</a>:</h4>
<p>yeah... that's not exactly readable</p>



<a name="177376499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376499">(Oct 04 2019 at 20:32)</a>:</h4>
<p>presumably called for <code>println!</code> stmt or such though</p>



<a name="177376585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376585">(Oct 04 2019 at 20:33)</a>:</h4>
<div class="codehilite"><pre><span></span>  %38 =
  insertvalue { {}*, [3 x i64]* } %37,
  i64* getelementptr inbounds (
      [3 x i64],
      [3 x i64]* bitcast (
          {
              void (%&quot;fmt::builders::PadAdapter&quot;*)*, i64, i64, i1 (%&quot;fmt::builders::PadAdapter&quot;*, [0 x i8]*, i64)*, i1 (%&quot;fmt::builders::PadAdapter&quot;*, i32)*, i1 (%&quot;fmt::builders::PadAdapter&quot;*, %&quot;fmt::Argume\
nts&quot;*)*
          }* @3
          to
          [3 x i64]*
      ),
      i32 0,
      i32 0
  ),
  1,
  !dbg !189
</pre></div>



<a name="177376592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376592">(Oct 04 2019 at 20:33)</a>:</h4>
<p>used emacs to at least pare up all the delimiters :)</p>



<a name="177376657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376657">(Oct 04 2019 at 20:34)</a>:</h4>
<p>I guess that's some kind of vtable cast</p>



<a name="177376718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376718">(Oct 04 2019 at 20:35)</a>:</h4>
<p><a href="https://llvm.org/docs/LangRef.html#id192" target="_blank" title="https://llvm.org/docs/LangRef.html#id192">insertvalue llvm docs</a></p>



<a name="177376722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376722">(Oct 04 2019 at 20:35)</a>:</h4>
<p>yes... I think so.</p>



<a name="177376747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376747">(Oct 04 2019 at 20:36)</a>:</h4>
<p>ok I sort of see what it's complaining about</p>



<a name="177376792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376792">(Oct 04 2019 at 20:36)</a>:</h4>
<p>the gep winds up pointing at a specific <code>i64</code> from the vtable</p>



<a name="177376800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376800">(Oct 04 2019 at 20:36)</a>:</h4>
<p>but it is being inserted into a <code>[3 x i164]*</code> field</p>



<a name="177376804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376804">(Oct 04 2019 at 20:36)</a>:</h4>
<p>it kind of looks like there is one argument too many on the gep</p>



<a name="177376814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376814">(Oct 04 2019 at 20:36)</a>:</h4>
<p>i.e., instead of gep(..., 0, 0) it should be gep(..., 0)</p>



<a name="177376820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376820">(Oct 04 2019 at 20:36)</a>:</h4>
<p>is this maybe ringing any bells for any of your edits? :)</p>



<a name="177376831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376831">(Oct 04 2019 at 20:37)</a>:</h4>
<p>/me thinks</p>



<a name="177376836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376836">(Oct 04 2019 at 20:37)</a>:</h4>
<p>I'm guessing it has to do something with the code that finds a "child" vtable</p>



<a name="177376837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376837">(Oct 04 2019 at 20:37)</a>:</h4>
<p>I do this: <code>bx.struct_gep(source_ptr, offset as u64)</code></p>



<a name="177376851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376851">(Oct 04 2019 at 20:37)</a>:</h4>
<p>this is this code</p>



<a name="177376853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376853">(Oct 04 2019 at 20:37)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">            </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;FOO: unsized_info: vtable={:?} offset={:?} &quot;</span><span class="p">,</span><span class="w"> </span><span class="n">vtable</span><span class="p">,</span><span class="w"> </span><span class="n">offset</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="n">bx</span><span class="p">.</span><span class="n">struct_gep</span><span class="p">(</span><span class="n">source_ptr</span><span class="p">,</span><span class="w"> </span><span class="n">offset</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">u64</span><span class="p">)</span><span class="w"></span>
</pre></div>



<a name="177376854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376854">(Oct 04 2019 at 20:37)</a>:</h4>
<p>the Rust interface to LLVM is very strongly-typed so I don't see how that can go wrong</p>



<a name="177376865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376865">(Oct 04 2019 at 20:37)</a>:</h4>
<p>unless it's simply the wrong offset?</p>



<a name="177376954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376954">(Oct 04 2019 at 20:38)</a>:</h4>
<p>no, it's more the number of arugments</p>



<a name="177376957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376957">(Oct 04 2019 at 20:38)</a>:</h4>
<p>than the value of them</p>



<a name="177376961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376961">(Oct 04 2019 at 20:38)</a>:</h4>
<p>I don't think the rust interface to llvm is this strongly typed</p>



<a name="177376968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376968">(Oct 04 2019 at 20:38)</a>:</h4>
<p>it doesn't reflect the <strong>llvm types</strong> of what's inside, does it?</p>



<a name="177376969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376969">(Oct 04 2019 at 20:38)</a>:</h4>
<p>hmm</p>



<a name="177376992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376992">(Oct 04 2019 at 20:39)</a>:</h4>
<p>of what's inside ptr's? no</p>



<a name="177376995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177376995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177376995">(Oct 04 2019 at 20:39)</a>:</h4>
<p>you're right there</p>



<a name="177377001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377001">(Oct 04 2019 at 20:39)</a>:</h4>
<p>anyway I'm trying to dump out sme debug print outs</p>



<a name="177377021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377021">(Oct 04 2019 at 20:39)</a>:</h4>
<p>this is also an inbounds gep</p>



<a name="177377024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377024">(Oct 04 2019 at 20:39)</a>:</h4>
<p>so maybe it's not that code</p>



<a name="177377123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377123">(Oct 04 2019 at 20:40)</a>:</h4>
<p><code>struct_gep</code> <em>is</em> the right call, isn't it?</p>



<a name="177377133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377133">(Oct 04 2019 at 20:41)</a>:</h4>
<p>I figured out the vtable is stored as a struct not an array</p>



<a name="177377136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377136">(Oct 04 2019 at 20:41)</a>:</h4>
<p>so presume it is</p>



<a name="177377248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377248">(Oct 04 2019 at 20:42)</a>:</h4>
<p>not sure</p>



<a name="177377260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377260">(Oct 04 2019 at 20:42)</a>:</h4>
<p>I was doing <code>inbounds_gep</code> before, and that created problems</p>



<a name="177377262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377262">(Oct 04 2019 at 20:42)</a>:</h4>
<p>so thismakes sense</p>



<a name="177377276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377276">(Oct 04 2019 at 20:43)</a>:</h4>
<p>I forget the difference to be totally honest :P</p>



<a name="177377285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377285">(Oct 04 2019 at 20:43)</a>:</h4>
<p><code>struct_gep</code> isn't translated to that LLVM at any stage,  is it?</p>



<a name="177377291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377291">(Oct 04 2019 at 20:43)</a>:</h4>
<p>heh yeah</p>



<a name="177377293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377293">(Oct 04 2019 at 20:43)</a>:</h4>
<p>it's weird to me</p>



<a name="177377294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377294">(Oct 04 2019 at 20:43)</a>:</h4>
<p>don't think so</p>



<a name="177377299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377299">(Oct 04 2019 at 20:43)</a>:</h4>
<p>but I'm looking at the backtrace</p>



<a name="177377307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377307">(Oct 04 2019 at 20:43)</a>:</h4>
<p>still trying to figure out where this particular llvm instruction is being generated</p>



<a name="177377316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377316">(Oct 04 2019 at 20:43)</a>:</h4>
<p>I'm not sure it's that code you cited</p>



<a name="177377319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377319">(Oct 04 2019 at 20:43)</a>:</h4>
<p>doesn't <em>quite</em> fit</p>



<a name="177377329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377329">(Oct 04 2019 at 20:43)</a>:</h4>
<p><code>ProjectionElem::Index</code> uses <code>inbounds_gep</code></p>



<a name="177377335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377335">(Oct 04 2019 at 20:44)</a>:</h4>
<p>yeah</p>



<a name="177377375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377375">(Oct 04 2019 at 20:44)</a>:</h4>
<p>I saw that...</p>



<a name="177377409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377409">(Oct 04 2019 at 20:44)</a>:</h4>
<p>/me runs in gdb to get backtrace</p>



<a name="177377427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377427">(Oct 04 2019 at 20:44)</a>:</h4>
<p>oh I should disable threading</p>



<a name="177377432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377432">(Oct 04 2019 at 20:45)</a>:</h4>
<p>that's probably confusing a lot of things</p>



<a name="177377466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377466">(Oct 04 2019 at 20:45)</a>:</h4>
<p>how...do you do that</p>



<a name="177377477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377477">(Oct 04 2019 at 20:45)</a>:</h4>
<p>-Ccodegen-units=1 is a good start</p>



<a name="177377539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377539">(Oct 04 2019 at 20:46)</a>:</h4>
<p>-Zno-parallel-llvm also</p>



<a name="177377545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377545">(Oct 04 2019 at 20:46)</a>:</h4>
<p>(maybe just the latter is enough)</p>



<a name="177377548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377548">(Oct 04 2019 at 20:46)</a>:</h4>
<p>yeah I just came to both of those :)</p>



<a name="177377550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377550">(Oct 04 2019 at 20:46)</a>:</h4>
<p>thanks</p>



<a name="177377559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377559">(Oct 04 2019 at 20:46)</a>:</h4>
<p>I don't think it hurts here either way, I'll add 'em both</p>



<a name="177377846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377846">(Oct 04 2019 at 20:51)</a>:</h4>
<p>hmm that causes a segfault and not the llvm assertion</p>



<a name="177377849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377849">(Oct 04 2019 at 20:51)</a>:</h4>
<p>so maybe that was a red herring</p>



<a name="177377865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177377865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177377865">(Oct 04 2019 at 20:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> there's projections being done for complex ADT upcasting... and I'm changing how that code is hit</p>



<a name="177378003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378003">(Oct 04 2019 at 20:53)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> it looks like struct-gep <em>is</em> compiled to inbounds gep</p>
<div class="codehilite"><pre><span></span>  <span class="n">Value</span> <span class="o">*</span><span class="nf">CreateStructGEP</span><span class="p">(</span><span class="n">Type</span> <span class="o">*</span><span class="n">Ty</span><span class="p">,</span> <span class="n">Value</span> <span class="o">*</span><span class="n">Ptr</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">Idx</span><span class="p">,</span>
                         <span class="k">const</span> <span class="n">Twine</span> <span class="o">&amp;</span><span class="n">Name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">CreateConstInBoundsGEP2_32</span><span class="p">(</span><span class="n">Ty</span><span class="p">,</span> <span class="n">Ptr</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Idx</span><span class="p">,</span> <span class="n">Name</span><span class="p">);</span>
  <span class="p">}</span>
</pre></div>



<a name="177378010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378010">(Oct 04 2019 at 20:53)</a>:</h4>
<p>ahh</p>



<a name="177378011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378011">(Oct 04 2019 at 20:54)</a>:</h4>
<p>so that explains <em>that</em></p>



<a name="177378057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378057">(Oct 04 2019 at 20:54)</a>:</h4>
<p>yeah I wondered</p>



<a name="177378075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378075">(Oct 04 2019 at 20:54)</a>:</h4>
<p>can you remind me what you are trying to do here :)</p>



<a name="177378080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378080">(Oct 04 2019 at 20:54)</a>:</h4>
<p>like, what vtable layout you have created</p>



<a name="177378082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378082">(Oct 04 2019 at 20:54)</a>:</h4>
<p>it's basically a big array</p>



<a name="177378090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378090">(Oct 04 2019 at 20:54)</a>:</h4>
<p>with "subvtables" embedded in it, right?</p>



<a name="177378110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378110">(Oct 04 2019 at 20:55)</a>:</h4>
<p>er, "Super" vtables I guess :)</p>



<a name="177378500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378500">(Oct 04 2019 at 21:00)</a>:</h4>
<p>also, what is the offset measured in?</p>



<a name="177378526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378526">(Oct 04 2019 at 21:00)</a>:</h4>
<p>I'm pretty sure the assert was not wrong, but something about <code>-Zno-parallel-llvm</code> leads to us squelching the error <em>somehow</em></p>



<a name="177378541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378541">(Oct 04 2019 at 21:00)</a>:</h4>
<p>I think the struct_gep is just wrong</p>



<a name="177378635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378635">(Oct 04 2019 at 21:01)</a>:</h4>
<p>the type that <em>LLVM</em> sees for this vtable is <code>[3 x i64]*</code> basically -- so calling <code>struct_gep(0)</code>, as you are doing, inserts a in-bounds gep of <code>[0, 0]</code>. In other words, you don't have a pointer to a struct from LLVM's POV, and that method is tailored to access a field of a struct.</p>



<a name="177378715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378715">(Oct 04 2019 at 21:02)</a>:</h4>
<p>I suspect you want a gep with one argument, to basically simulate (in C) <code>ptr + offset</code></p>



<a name="177378747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378747">(Oct 04 2019 at 21:02)</a>:</h4>
<p>but the question is what the offset is measured in (I'd sort of expect "words", in which case we have the wrong llvm type)</p>



<a name="177378768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177378768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177378768">(Oct 04 2019 at 21:02)</a>:</h4>
<p>I guess that when bootstrapping the offset should always be zero</p>



<a name="177379213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379213">(Oct 04 2019 at 21:09)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> so I changed to <code>inbounds_gep</code> to remove the extra <code>0</code> and I am bootstrapping; I pushed a commit for now to your branch, but the code is almost certainly wrong for <code>offset != 0</code></p>



<a name="177379248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379248">(Oct 04 2019 at 21:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> offset is measured in... not sure? eddyb just told me it was the right type layout</p>



<a name="177379310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379310">(Oct 04 2019 at 21:10)</a>:</h4>
<p>yeah, it segfaults fo <code>offset != 0</code></p>



<a name="177379319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379319">(Oct 04 2019 at 21:10)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> offset is measured in... not sure? eddyb just told me it was the right type layout</p>
</blockquote>
<p>I'll take a look later, but I suspect it's words</p>



<a name="177379335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379335">(Oct 04 2019 at 21:10)</a>:</h4>
<p>anyway, thanks for explaining</p>



<a name="177379338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379338">(Oct 04 2019 at 21:10)</a>:</h4>
<p>yeah</p>



<a name="177379343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379343">(Oct 04 2019 at 21:10)</a>:</h4>
<p>probably</p>



<a name="177379351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379351">(Oct 04 2019 at 21:10)</a>:</h4>
<p>one sec, I can look now</p>



<a name="177379478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379478">(Oct 04 2019 at 21:12)</a>:</h4>
<p>I'm not sure why the type is <code>[i64 x 3]*</code> and not just <code>i64*</code> or somethign</p>



<a name="177379480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379480">(Oct 04 2019 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yep, words</p>



<a name="177379486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379486">(Oct 04 2019 at 21:12)</a>:</h4>
<p>it seems like <code>i64*</code> is what we really want</p>



<a name="177379489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379489">(Oct 04 2019 at 21:12)</a>:</h4>
<p><code>const_usize</code> is used to generate some values</p>



<a name="177379504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379504">(Oct 04 2019 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> would probably have informed opinions here</p>



<a name="177379852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177379852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177379852">(Oct 04 2019 at 21:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> grep for <code>pub fn get_vtable</code> if you want to see how the vtable is constructed now</p>



<a name="177385383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177385383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177385383">(Oct 04 2019 at 22:46)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> finding it hard to discern why the type of the vtable in LLVM is <code>[i64 x 3]*</code>... I think that's what's causing the segfault</p>



<a name="177531905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177531905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177531905">(Oct 07 2019 at 15:45)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> did you push any updates?</p>



<a name="177532350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177532350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177532350">(Oct 07 2019 at 15:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> pushed (last commit is experimentation).</p>



<a name="177532432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177532432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177532432">(Oct 07 2019 at 15:50)</a>:</h4>
<p>basically, I think <code>struct_gep</code> somehow <em>feels</em> right still, given the vtable is a struct, and in practical terms it seems to get <em>more</em> working. the LLVM vtable type still seems wrong though, which is odd.</p>



<a name="177532476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177532476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177532476">(Oct 07 2019 at 15:50)</a>:</h4>
<p>and I know <code>struct_gep</code> apparently passes one too many args, but maybe there's another cause of that? it's just all very weird to me</p>



<a name="177532483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177532483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177532483">(Oct 07 2019 at 15:50)</a>:</h4>
<p>anyway, I still get the segfault  here</p>



<a name="177532522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177532522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177532522">(Oct 07 2019 at 15:51)</a>:</h4>
<p>segfaults on the last <code>println</code> of <a href="https://gist.github.com/2e47ba39c1bd5b3a4dcfff5d2e5660e5" target="_blank" title="https://gist.github.com/2e47ba39c1bd5b3a4dcfff5d2e5660e5">this</a></p>



<a name="177542594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177542594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177542594">(Oct 07 2019 at 17:45)</a>:</h4>
<blockquote>
<p>basically, I think <code>struct_gep</code> somehow <em>feels</em> right still, given the vtable is a struct, and in practical terms it seems to get <em>more</em> working. the LLVM vtable type still seems wrong though, which is odd.</p>
</blockquote>
<p>struct-gep is only right if we have an accurate type for the vtable</p>



<a name="177542632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177542632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177542632">(Oct 07 2019 at 17:45)</a>:</h4>
<p>hmm with my changes I am getting these errors, <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span>, which seem familiar:</p>
<div class="codehilite"><pre><span></span>error[E0283]: type annotations needed: cannot resolve `dyn emitter::Emitter + rustc_data_structures::sync::Send: rustc_data_structures::sync::Send`
   --&gt; src/librustc_errors/lib.rs:427:13
    |
427 |             emitter,
    |             ^^^^^^^
    |
    = note: required for the cast to the object type `dyn emitter::Emitter + rustc_data_structures::sync::Send`

error[E0283]: type annotations needed: cannot resolve `dyn emitter::Emitter + rustc_data_structures::sync::Send: rustc_data_structures::sync::Send`
   --&gt; src/librustc_errors/lib.rs:446:17
    |
446 |                 emitter,
    |                 ^^^^^^^
    |
    = note: required for the cast to the object type `dyn emitter::Emitter + rustc_data_structures::sync::Send`

error[E0283]: type annotations needed: cannot resolve `dyn SourceMapper + rustc_data_structures::sync::Send + rustc_data_structures::sync::Sync: rustc_data_structures::sync::Sync`
    --&gt; src/librustc_errors/emitter.rs:1480:55
     |
1480 |             let suggestions = suggestion.splice_lines(&amp;**sm);
     |                                                       ^^^^^
     |
     = note: required for the cast to the object type `dyn SourceMapper + rustc_data_structures::sync::Send + rustc_data_structures::sync::Sync`
</pre></div>



<a name="177542688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177542688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177542688">(Oct 07 2019 at 17:46)</a>:</h4>
<p>I think we were going to add some sort of .. hack or <em>something</em> to work around these, right?</p>



<a name="177542715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177542715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177542715">(Oct 07 2019 at 17:46)</a>:</h4>
<p>I guess building with parallel-compiler=true ought to be enough for now</p>



<a name="177544231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177544231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177544231">(Oct 07 2019 at 18:02)</a>:</h4>
<p>we already added the hack, <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="177544241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177544241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177544241">(Oct 07 2019 at 18:02)</a>:</h4>
<p>at least, I added something</p>



<a name="177544270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177544270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177544270">(Oct 07 2019 at 18:03)</a>:</h4>
<p>see the bit where I handle auto traits separately</p>



<a name="177544397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177544397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177544397">(Oct 07 2019 at 18:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'm stil doing the hack to bootstrap by building stage 0 master than stage 1 of this branch on top of it</p>



<a name="177544449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177544449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177544449">(Oct 07 2019 at 18:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> BTW was trying to get the vtable ptr to be the right think using <code>const_ptrcast</code> in my "experimentation" commit</p>



<a name="177544458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177544458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177544458">(Oct 07 2019 at 18:05)</a>:</h4>
<p>doesn't seem to have worked</p>



<a name="177544486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177544486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177544486">(Oct 07 2019 at 18:05)</a>:</h4>
<p>that is, it's not hurt the situation, but it's not made the second <code>println!</code> in my Gist work either</p>



<a name="177553041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177553041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177553041">(Oct 07 2019 at 19:47)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ok so now i'm seeing <em>this</em></p>
<div class="codehilite"><pre><span></span>error: internal compiler error: src/librustc_codegen_ssa/base.rs:164: unsized_info: invalid unsizing std::marker::PhantomData&lt;dyn rustc_errors::SourceMapper + std::marker::Send + std::marker::Sync&gt; -&gt; std::marker::PhantomData&lt;dyn rustc_errors::SourceMapper + std::marker\
::Send + std::marker::Sync&gt;
</pre></div>


<p>I think you pushed something realted to that?</p>



<a name="177553053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177553053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177553053">(Oct 07 2019 at 19:47)</a>:</h4>
<p>(I'm not yet using the latest tip of your branch)</p>



<a name="177553076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177553076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177553076">(Oct 07 2019 at 19:47)</a>:</h4>
<p>ok but I see it has a workaround for that</p>



<a name="177560075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177560075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177560075">(Oct 07 2019 at 20:58)</a>:</h4>
<p>Yeah exactly</p>



<a name="177560176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177560176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177560176">(Oct 07 2019 at 20:59)</a>:</h4>
<p>Latest commit fixes that (maybe?)</p>



<a name="177560190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177560190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177560190">(Oct 07 2019 at 21:00)</a>:</h4>
<p>But still issue with Arc</p>



<a name="177561733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177561733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177561733">(Oct 07 2019 at 21:15)</a>:</h4>
<p>So I'm trying to summon <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="177562018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177562018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177562018">(Oct 07 2019 at 21:19)</a>:</h4>
<p>in any case I think the right fix here -- at least for short-term -- is to cast the vtable to a u64* and do an in-bounds gep</p>



<a name="177562019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177562019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177562019">(Oct 07 2019 at 21:19)</a>:</h4>
<p>and then cast back</p>



<a name="177562026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177562026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177562026">(Oct 07 2019 at 21:19)</a>:</h4>
<p>it doesn't feel the most elegant and it seems like our "typing" of vtables in general could use to be updated</p>



<a name="177562641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177562641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177562641">(Oct 07 2019 at 21:27)</a>:</h4>
<p>ultimately the cleaner way would probably be to have an accurate Layout for the vtables, so we can cast to that and do a struct gep to the appropriate field</p>



<a name="177565896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177565896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177565896">(Oct 07 2019 at 22:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> makes sense.</p>



<a name="177565909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177565909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177565909">(Oct 07 2019 at 22:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> could try that for now though... and leave a note. should I?</p>



<a name="177566272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177566272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177566272">(Oct 07 2019 at 22:18)</a>:</h4>
<blockquote>
<p>in any case I think the right fix here -- at least for short-term -- is to cast the vtable to a u64* and do an in-bounds gep</p>
</blockquote>
<p>I think you should try this for now</p>



<a name="177567459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177567459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177567459">(Oct 07 2019 at 22:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> will do, ta</p>



<a name="177569795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177569795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177569795">(Oct 07 2019 at 23:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> we want u64 and not usize?</p>



<a name="177569994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177569994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177569994">(Oct 07 2019 at 23:13)</a>:</h4>
<p>--deleted--</p>



<a name="177569996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177569996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177569996">(Oct 07 2019 at 23:13)</a>:</h4>
<p>--deleted--</p>



<a name="177570785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177570785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177570785">(Oct 07 2019 at 23:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> curious error now: <a href="https://gist.github.com/54483ab2c86451c0ba36d006f2a13c64" target="_blank" title="https://gist.github.com/54483ab2c86451c0ba36d006f2a13c64">https://gist.github.com/54483ab2c86451c0ba36d006f2a13c64</a></p>



<a name="177571406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177571406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177571406">(Oct 07 2019 at 23:39)</a>:</h4>
<p>--deleted--</p>



<a name="177573612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177573612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177573612">(Oct 08 2019 at 00:22)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> pushed a bit more experimentation, but now I'm skeptical that <code>src/librustc_codegen_ssa/base.rs:283</code> is the right approach / sufficient.</p>



<a name="177573627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177573627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177573627">(Oct 08 2019 at 00:23)</a>:</h4>
<p>because it leads to <code>unsized_info</code> having to handle not only <code>PhantomData</code>, but also other types like <code>NonNull</code>... that doesn't feel right. even if there's a finite number of special cases, surely this is wrong?</p>



<a name="177627428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177627428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177627428">(Oct 08 2019 at 15:29)</a>:</h4>
<p>the problem is assertion failures?</p>



<a name="177627436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177627436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177627436">(Oct 08 2019 at 15:29)</a>:</h4>
<p>I'll try to take a look</p>



<a name="177630498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177630498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177630498">(Oct 08 2019 at 16:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> segfault with the same Gist as before. didn't try bootstrapping, so no assertion failures.</p>



<a name="177630513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177630513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177630513">(Oct 08 2019 at 16:01)</a>:</h4>
<p>sorry for keeping on bugging you. this is a pretty gnarly issue, I hope you agree!</p>



<a name="177721021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177721021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177721021">(Oct 09 2019 at 14:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> but yeah, if you do something like this, you get an invalid types error in <code>unsized_info</code> (because it's not equipped to handle <code>NonNull</code>)...</p>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">bar</span>: <span class="nc">NonNull</span><span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Bar</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">NonNull</span>::<span class="n">new</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="mi">42</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="o">*</span><span class="k">mut</span><span class="w"> </span><span class="n">_</span><span class="p">).</span><span class="n">unwrap</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;Arc-bar: {}&quot;</span><span class="p">,</span><span class="w"> </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">bar</span><span class="p">.</span><span class="n">as_ref</span><span class="p">()</span><span class="w"> </span><span class="p">});</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span>: <span class="nc">NonNull</span><span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Foo</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bar</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;Arc-foo: {}&quot;</span><span class="p">,</span><span class="w"> </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">foo</span><span class="p">.</span><span class="n">as_ref</span><span class="p">()</span><span class="w"> </span><span class="p">});</span><span class="w"></span>
</pre></div>



<a name="177757684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177757684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177757684">(Oct 09 2019 at 21:25)</a>:</h4>
<p>gnarly indeed! ping away, but I may not get time to investigate until friday</p>



<a name="177760110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177760110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177760110">(Oct 09 2019 at 22:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> cheers. this is all the investigation I've managed to do so far (not sure I can do much more of the useful variety given my current level of understanding), but Friday is fine with me.</p>



<a name="177760127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177760127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177760127">(Oct 09 2019 at 22:02)</a>:</h4>
<p>whenever you do get to it, just ping me likewise. ta.</p>



<a name="177821018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177821018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177821018">(Oct 10 2019 at 15:25)</a>:</h4>
<p>--deleted--</p>



<a name="177913086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177913086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177913086">(Oct 11 2019 at 14:40)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> let me know if you get around to this today :-)</p>



<a name="177928060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928060">(Oct 11 2019 at 17:15)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I'll take a look now</p>



<a name="177928459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928459">(Oct 11 2019 at 17:20)</a>:</h4>
<p>thanks <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="177928573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928573">(Oct 11 2019 at 17:21)</a>:</h4>
<p>BTW</p>



<a name="177928595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928595">(Oct 11 2019 at 17:21)</a>:</h4>
<p>I have to be honest, this whole  design process thing sounds like a lot of painful bureaucracy, and introduces many more delays.</p>



<a name="177928619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928619">(Oct 11 2019 at 17:21)</a>:</h4>
<p>I'm not sure I really want to go through it, considering how much effort I've put into work on my REPL anyway, and the delays so far...</p>



<a name="177928767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928767">(Oct 11 2019 at 17:23)</a>:</h4>
<p>it's just not very encouraging for me, when the time and it's continuing to demand from me is so great.</p>



<a name="177928778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928778">(Oct 11 2019 at 17:23)</a>:</h4>
<p>sorry... just had to clear that up.</p>



<a name="177928803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928803">(Oct 11 2019 at 17:23)</a>:</h4>
<p>I appreciate that it sounds like bureaucracy. On the other hand, I think it's the reality of contributing to a major project. Tech debt is a big problem for us right now that slows everything down. A big part of getting out from under that is trying to (a) do design more actively, (b) be a bit careful about what we land and (c) help to spread understanding by talking over and documenting our intentions.</p>



<a name="177928878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928878">(Oct 11 2019 at 17:24)</a>:</h4>
<p>One of the biggest problems I think we have now is that we've historically had no great procs</p>



<a name="177928888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928888">(Oct 11 2019 at 17:24)</a>:</h4>
<p>which means that big PRs can easily just get stuck</p>



<a name="177928906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928906">(Oct 11 2019 at 17:24)</a>:</h4>
<p>sure</p>



<a name="177928909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928909">(Oct 11 2019 at 17:24)</a>:</h4>
<p>but</p>



<a name="177928924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928924">(Oct 11 2019 at 17:24)</a>:</h4>
<p>i.e., I think that if we'd had this process working smoothly from the beginning, you would have been doing it much earlier on, and thing sowuld be better.</p>



<a name="177928931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928931">(Oct 11 2019 at 17:24)</a>:</h4>
<p>Unfortunately, it has to start somewhere.</p>



<a name="177928972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177928972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177928972">(Oct 11 2019 at 17:25)</a>:</h4>
<p>the fact I have to wait 2 weeks even to get the proposal considered, THEN a meeting booked in, THEN the meeting carried out, THEN a decision made, THEN probably more changes to the PR, THEN finally another review and acceptance</p>



<a name="177929008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177929008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177929008">(Oct 11 2019 at 17:25)</a>:</h4>
<p>I just don't have the willpower or desire to go through that right now, I'm afraid... and not sure when I will.</p>



<a name="177929072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177929072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177929072">(Oct 11 2019 at 17:26)</a>:</h4>
<p>I could understand if it were done fairly quickly, but it will be a month or more before a decision is made on entrance of REPL parts into the compiler, I think</p>



<a name="177929079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177929079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177929079">(Oct 11 2019 at 17:26)</a>:</h4>
<p>so a fork sounds like the best way to go now</p>



<a name="177930027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177930027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177930027">(Oct 11 2019 at 17:36)</a>:</h4>
<p>anyway, re. trait upcasting</p>



<a name="177930053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177930053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177930053">(Oct 11 2019 at 17:36)</a>:</h4>
<p>thanks for taking a look. I have to be off now, but will be back later. feel free to leave notes here or on GH.</p>



<a name="177952217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177952217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177952217">(Oct 11 2019 at 21:40)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ^</p>



<a name="177952627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177952627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177952627">(Oct 11 2019 at 21:46)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I'm looking :)</p>



<a name="177952632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177952632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177952632">(Oct 11 2019 at 21:47)</a>:</h4>
<p>I got distracted because my sister is here for a visit</p>



<a name="177952641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177952641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177952641">(Oct 11 2019 at 21:47)</a>:</h4>
<p>At the moment I'm trying to reproduce the error in gdb so I can see the stack trace</p>



<a name="177952642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177952642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177952642">(Oct 11 2019 at 21:47)</a>:</h4>
<p>this is kind of driving me crazy</p>



<a name="177952648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177952648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177952648">(Oct 11 2019 at 21:47)</a>:</h4>
<p>but I think I finally found the thing to do</p>



<a name="177952667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177952667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177952667">(Oct 11 2019 at 21:47)</a>:</h4>
<p>lol though it's not that useful</p>



<a name="177954434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177954434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177954434">(Oct 11 2019 at 22:15)</a>:</h4>
<p>heh</p>



<a name="177954443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177954443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177954443">(Oct 11 2019 at 22:15)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> no worries.. :-)</p>



<a name="177954453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177954453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177954453">(Oct 11 2019 at 22:15)</a>:</h4>
<p>what's the "thing to do then"?</p>



<a name="177955091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177955091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177955091">(Oct 11 2019 at 22:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> as for for the PR and REPL stuff... I thought about it again, and I'm struggling to see how this can't be construed as "experimentation under master", which shouldn't really need an RFC or design meeting or anything like that. You know I'd be happy with a compromise like a single meeting in the next week  or 10 days to flesh things out (plus a design doc from me, if you like), but yeah, something like that would be the most I could feasibly offer, sorry.</p>



<a name="177967314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177967314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177967314">(Oct 12 2019 at 02:58)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I think a design doc is a great start -- personally I think that we probably want to aim for design doc and then FCP, which may lead to a design meeting if there are objections (but with a select few -- maybe PR author and those listing concerns) which can be more adhoc</p>



<a name="177968540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177968540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177968540">(Oct 12 2019 at 03:38)</a>:</h4>
<p>(deleted)</p>



<a name="177968619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177968619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177968619">(Oct 12 2019 at 03:40)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> Oh, that sounds much more bearable. I could probably be happy with something like that. If <span class="user-mention" data-user-id="116009">@nikomatsakis</span> thinks that’s a reasonable way to go too, then let’s proceed with that.</p>



<a name="177993879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177993879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177993879">(Oct 12 2019 at 15:34)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I agree with <span class="user-mention" data-user-id="116122">@simulacrum</span>  that a design doc is a good start. If the changes are simple enough, maybe that's all we need.</p>



<a name="177993884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177993884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177993884">(Oct 12 2019 at 15:34)</a>:</h4>
<p>Regarding your branch:</p>
<p>I'm not quite sure what the problem is, but I obesrved that this example fails all on its own</p>
<div class="codehilite"><pre><span></span><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">any</span>::<span class="n">Any</span><span class="p">;</span><span class="w"></span>
<span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">rc</span>::<span class="n">Rc</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">Rc</span><span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Any</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">panic</span><span class="o">!</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">Rc</span><span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Any</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">bar</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="177995421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177995421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177995421">(Oct 12 2019 at 16:12)</a>:</h4>
<p>honestly, this seems like a bit of a pre-existing bug -- at minimum, it's very confusing what the "llvm type" of a vtable is</p>



<a name="177995439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177995439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177995439">(Oct 12 2019 at 16:13)</a>:</h4>
<p>(ps, we're going to be needing a design doc for this work, too, I think; I'm happy to help some with that)</p>



<a name="177998846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177998846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177998846">(Oct 12 2019 at 17:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Okay, that sounds like we could have a compromise, hopefully... thanks for understanding. I'll create that design doc this weekend if possible. Should it be a PR to the compiler team repo?</p>



<a name="177998900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/177998900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#177998900">(Oct 12 2019 at 17:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I agree... the LLVM type of the vtable is a point of confusion. Because the rustc type is a struct, that may be having odd consequences? Yes, I think we mentioned a design doc when we originally discussed this effort months ago. I know someone else had volunteered to help with that then, but forget who. But if we could do it together, that may be workable anyway.</p>



<a name="178010449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178010449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178010449">(Oct 12 2019 at 23:04)</a>:</h4>
<blockquote>
<p>I'll create that design doc this weekend if possible. Should it be a PR to the compiler team repo?</p>
</blockquote>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> just start with a hackmd or something</p>



<a name="178010569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178010569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178010569">(Oct 12 2019 at 23:08)</a>:</h4>
<p>Will do, ta.</p>



<a name="178087980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178087980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178087980">(Oct 14 2019 at 09:38)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> to expand a bit on the vtable type, it seems like <em>some</em> code expects <code>[i64 x 3]*</code> and <em>some</em> code expects <code>i64*</code> and I can't quite understand why that would be</p>



<a name="178087997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178087997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178087997">(Oct 14 2019 at 09:38)</a>:</h4>
<p>tbh I don't fully know where <em>either</em> of those types are coming from anymore, so I guess I would need to dig a bit more into it</p>



<a name="178088043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088043">(Oct 14 2019 at 09:39)</a>:</h4>
<p>but e.g. this error that I see when bootstrapping</p>
<div class="codehilite"><pre><span></span>Invalid InsertValueInst operands!
  %8 = insertvalue { i64*, i64* } %7, [3 x i64]* bitcast ({ void (%&quot;cstore::CrateMetadata&quot;*)*, i64, i64, i64 (%&quot;cstore::CrateMetadata&quot;*)* }* @458 to [3 x i64]*), 1, !dbg !69145
in function _ZN14rustc_metadata11cstore_impl94_$LT$impl$u20$rustc..middle..cstore..CrateStore$u20$for$u20$rustc_metadata..cstore..CStore$GT$20crate_data_as_rc_any17he9ec2a22b2b45625E
</pre></div>



<a name="178088047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088047">(Oct 14 2019 at 09:39)</a>:</h4>
<p>seems to be arising out of this confusion</p>



<a name="178088049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088049">(Oct 14 2019 at 09:39)</a>:</h4>
<p>in this case, we expect a <code>i64*</code></p>



<a name="178088121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088121">(Oct 14 2019 at 09:40)</a>:</h4>
<p>the annoying thing being that we <em>HAVE</em> a <code>i64*</code> and we bitcast it to <code>[i64 x 3]*</code>, but I know that if you remove that bitcast, it does much earlier :)</p>



<a name="178088163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088163">(Oct 14 2019 at 09:41)</a>:</h4>
<p>still, hmm, looking at the logs the <code>old_info</code> is <em>always</em> a <code>[3 x i64]*</code></p>



<a name="178088166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088166">(Oct 14 2019 at 09:41)</a>:</h4>
<p>so maybe the problem is somewhere <em>else</em></p>



<a name="178088608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088608">(Oct 14 2019 at 09:49)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> btw, do you build with </p>
<div class="codehilite"><pre><span></span>[llvm]
assertions = true
</pre></div>


<p>I am giving that a try now, I forgot this required an extra step</p>



<a name="178088668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178088668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178088668">(Oct 14 2019 at 09:50)</a>:</h4>
<p>also, pushed a few commits</p>



<a name="178092126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178092126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178092126">(Oct 14 2019 at 10:43)</a>:</h4>
<p>Ah, nice, enabling llvm.assertions causes some errors earlier</p>



<a name="178115572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178115572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178115572">(Oct 14 2019 at 16:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I don’t believe so (away from computer now). But fair point.</p>



<a name="178115601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178115601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178115601">(Oct 14 2019 at 16:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> That’s annoying about the different LLVM types, but good spot.</p>



<a name="178122663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178122663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178122663">(Oct 14 2019 at 17:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> oh, I had set assertions on... that probably explains why I got that error previously</p>



<a name="178122674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178122674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178122674">(Oct 14 2019 at 17:39)</a>:</h4>
<p>the bootstrapping one</p>



<a name="178122675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178122675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178122675">(Oct 14 2019 at 17:39)</a>:</h4>
<p>a couple of weeks ago</p>



<a name="178141052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178141052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178141052">(Oct 14 2019 at 21:31)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> seems good</p>



<a name="178151354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178151354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178151354">(Oct 15 2019 at 00:46)</a>:</h4>
<p>digging a bit more it seems the llvm version of <code>std::ptr::NonNull&lt;std::rc::RcBox&lt;dyn std::any::Any&gt;&gt;</code> is <code>{i64*,i64*}</code> but (e.g.) <code>Box&lt;dyn Any + Send&gt;</code> is <code>{ {}*, [3 x i64]* }</code></p>



<a name="178156985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178156985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178156985">(Oct 15 2019 at 03:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> huh. I'm not sure what to make of that!</p>



<a name="178156992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178156992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178156992">(Oct 15 2019 at 03:17)</a>:</h4>
<p>we need consistency though, either way (which is the better LLVM type?)</p>



<a name="178219694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178219694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178219694">(Oct 15 2019 at 18:16)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> yeah I'm not quite sure</p>



<a name="178219771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178219771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178219771">(Oct 15 2019 at 18:17)</a>:</h4>
<p>I pinged <span class="user-mention" data-user-id="119009">@eddyb</span> and they  wrote this:</p>
<blockquote>
<p>years ago I wasted a few months trying to help with the LLVM pointee type removal<br>
specifically so we could unpack newtypes and stuff. this best-effort approach was basically the fallback<br>
the reason we even do pointee types anymore is LLVM still relies on them in places, frustratingly enough<br>
it's the same reason removing them is so hard<br>
anyway the trick is to 1. not expect anything 2. always cast to scalar_pair_element_type_of or w/e</p>
</blockquote>
<p>which seems pretty close to what we're already doing, so I'm not quite sure what the problem is</p>



<a name="178219920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178219920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178219920">(Oct 15 2019 at 18:18)</a>:</h4>
<p>yeah hmm</p>



<a name="178219941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178219941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178219941">(Oct 15 2019 at 18:18)</a>:</h4>
<p>should we be bitcasting rather than pointer-casting?</p>



<a name="178219949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178219949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178219949">(Oct 15 2019 at 18:18)</a>:</h4>
<p>not sure of the exact difference in fact, <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="178219961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178219961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178219961">(Oct 15 2019 at 18:19)</a>:</h4>
<p>I see both are done in existing code...</p>



<a name="178220261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220261">(Oct 15 2019 at 18:22)</a>:</h4>
<p>So let me drop down a few notes</p>



<a name="178220289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220289">(Oct 15 2019 at 18:22)</a>:</h4>
<p>What happens is that we get a <code>Rc&lt;dyn Foo&gt;</code> and we want to "upcast" it to <code>Rc&lt;dyn Foo&gt;</code></p>



<a name="178220354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220354">(Oct 15 2019 at 18:23)</a>:</h4>
<p>we take the old info, do a "zero" adjustment to it, and return back a <code>OperandPair</code> or whatever; the types of the 'old info' in this bit of code seems to be <code>[3 x i64]*</code></p>



<a name="178220363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220363">(Oct 15 2019 at 18:23)</a>:</h4>
<p>hmm the MIR is:</p>



<a name="178220475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220475">(Oct 15 2019 at 18:24)</a>:</h4>
<div class="codehilite"><pre><span></span>fn  bar() -&gt; std::rc::Rc&lt;dyn std::any::Any&gt; {
    let mut _0: std::rc::Rc&lt;dyn std::any::Any&gt;; // return place in scope 0 at /home/nmatsakis/tmp/any_any.rs:8:13: 8:24
    let mut _1: std::rc::Rc&lt;dyn std::any::Any&gt;; // in scope 0 at /home/nmatsakis/tmp/any_any.rs:9:5: 9:10
    let mut _2: std::rc::Rc&lt;dyn std::any::Any&gt;; // in scope 0 at /home/nmatsakis/tmp/any_any.rs:9:5: 9:10

    bb0: {
        StorageLive(_1);                 // bb0[0]: scope 0 at /home/nmatsakis/tmp/any_any.rs:9:5: 9:10
        StorageLive(_2);                 // bb0[1]: scope 0 at /home/nmatsakis/tmp/any_any.rs:9:5: 9:10
        _2 = const foo() -&gt; bb1;         // bb0[2]: scope 0 at /home/nmatsakis/tmp/any_any.rs:9:5: 9:10
                                         // ty::Const
                                         // + ty: fn() -&gt; std::rc::Rc&lt;(dyn std::any::Any + &#39;static)&gt; {foo}
                                         // + val: Scalar(&lt;ZST&gt;)
                                         // mir::Constant
                                         // + span: /home/nmatsakis/tmp/any_any.rs:9:5: 9:8
                                         // + literal: Const { ty: fn() -&gt; std::rc::Rc&lt;(dyn std::any::Any + &#39;static)&gt; {foo}, val: Scalar\
(&lt;ZST&gt;) }
    }

    bb1: {
        _1 = move _2 as std::rc::Rc&lt;dyn std::any::Any&gt; (Pointer(Unsize)); // bb1[0]: scope 0 at /home/nmatsakis/tmp/any_any.rs:9:5: 9:10
        StorageDead(_2);                 // bb1[1]: scope 0 at /home/nmatsakis/tmp/any_any.rs:9:9: 9:10
        _0 = move _1 as std::rc::Rc&lt;dyn std::any::Any&gt; (Pointer(Unsize)); // bb1[2]: scope 0 at /home/nmatsakis/tmp/any_any.rs:9:5: 9:10
        StorageDead(_1);                 // bb1[3]: scope 0 at /home/nmatsakis/tmp/any_any.rs:10:1: 10:2
        return;                          // bb1[4]: scope 0 at /home/nmatsakis/tmp/any_any.rs:10:2: 10:2
    }
}
</pre></div>



<a name="178220547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220547">(Oct 15 2019 at 18:25)</a>:</h4>
<p>so I think what happens is that when we create the "pair" for <code>_0</code>, we associated it with the two llvm values, and they have the <code>[3 x i64]*</code> type</p>



<a name="178220553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220553">(Oct 15 2019 at 18:25)</a>:</h4>
<p>then the <code>return</code> tries to use insertvalue to build the return value</p>



<a name="178220567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220567">(Oct 15 2019 at 18:25)</a>:</h4>
<p>but at that point the types disagree</p>



<a name="178220579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220579">(Oct 15 2019 at 18:25)</a>:</h4>
<p>some kind of adaptation is missing</p>



<a name="178220849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178220849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178220849">(Oct 15 2019 at 18:28)</a>:</h4>
<p>Some pointers <span class="user-mention" data-user-id="119009">@eddyb</span> to relevant bits of source:</p>
<ul>
<li>the <a href="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/base.rs#L123-L128" target="_blank" title="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/base.rs#L123-L128"><code>unsized_info</code></a> function is the one doing the "upcast" (in this case, a noop)</li>
<li>it <a href="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/base.rs#L160-L161" target="_blank" title="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/base.rs#L160-L161">casts the oldinfo</a> into <code>i64*</code> and then <a href="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/base.rs#L166-L169" target="_blank" title="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/base.rs#L166-L169">casts back</a></li>
<li>the actual LLVM error occurs <a href="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/mir/operand.rs#L443-L445" target="_blank" title="https://github.com/rust-lang/rust/blob/83bd038de97941ead4965914ea07e32cf2acf0c8/src/librustc_codegen_ssa/mir/operand.rs#L443-L445">because <code>Some</code> is returned here</a> and the result doesn't have the type expected</li>
</ul>



<a name="178224795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178224795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178224795">(Oct 15 2019 at 19:12)</a>:</h4>
<p>Okay let’s wait and see what he suggests. Thanks <span class="user-mention" data-user-id="116009">@nikomatsakis</span>.</p>



<a name="178311211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178311211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178311211">(Oct 16 2019 at 17:40)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I'm thinking about how we can get some of this work landed -- I hate "open forever" PRs -- maybe we should try to extract the "type system" work into something we can land and leave the codegen work as a fixme (it could just ICE for now when a non-zero offset is found, for example)</p>



<a name="178312461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178312461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178312461">(Oct 16 2019 at 17:54)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah, true (and I hate open-forever PRs too)</p>



<a name="178315619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178315619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178315619">(Oct 16 2019 at 18:24)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> if you have any more ideas of what to try while we're waiting for eddyb to response, let me know... otherwise I can separate out the codegen stuff, add in a feature gate, and we can get the stuff working so far merged.</p>



<a name="178670180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178670180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178670180">(Oct 21 2019 at 16:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I’ll try to just get all the stuff but the codegen merged now okay? Maybe you can review?</p>



<a name="178670445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178670445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178670445">(Oct 21 2019 at 16:09)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> sounds great! I've not had time to do anything further yet</p>



<a name="178688913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178688913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178688913">(Oct 21 2019 at 19:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> no worries. want to talk about it briefly now though? where we go from here.</p>



<a name="178698740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698740">(Oct 21 2019 at 21:04)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> sorry I'm around-ish now</p>



<a name="178698767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698767">(Oct 21 2019 at 21:05)</a>:</h4>
<p>one question I was thinking about, did you ever solve that issue with type-checking when parallel compilation is <em>not</em> enable?</p>



<a name="178698782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698782">(Oct 21 2019 at 21:05)</a>:</h4>
<p>I remember we had discussed various work arounds</p>



<a name="178698801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698801">(Oct 21 2019 at 21:05)</a>:</h4>
<p>that's alright</p>



<a name="178698802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698802">(Oct 21 2019 at 21:05)</a>:</h4>
<p>err</p>



<a name="178698809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698809">(Oct 21 2019 at 21:05)</a>:</h4>
<p>I'd implemented one</p>



<a name="178698822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698822">(Oct 21 2019 at 21:05)</a>:</h4>
<p>and I thought it was working yes</p>



<a name="178698899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698899">(Oct 21 2019 at 21:06)</a>:</h4>
<p>can't remember when in the code it is though <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="178698900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698900">(Oct 21 2019 at 21:06)</a>:</h4>
<p>hmm</p>



<a name="178698911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698911">(Oct 21 2019 at 21:06)</a>:</h4>
<p>I put it before the recent commits though</p>



<a name="178698912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698912">(Oct 21 2019 at 21:06)</a>:</h4>
<p>ok :)</p>



<a name="178698917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698917">(Oct 21 2019 at 21:06)</a>:</h4>
<p>let me look...</p>



<a name="178698974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698974">(Oct 21 2019 at 21:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> it's where the obligations are generated</p>



<a name="178698981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178698981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178698981">(Oct 21 2019 at 21:07)</a>:</h4>
<p>I forget the file for that, sorry</p>



<a name="178699163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178699163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178699163">(Oct 21 2019 at 21:09)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> it's ok,</p>



<a name="178699169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178699169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178699169">(Oct 21 2019 at 21:09)</a>:</h4>
<p>I'll find it soon enough :)</p>



<a name="178699245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178699245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178699245">(Oct 21 2019 at 21:10)</a>:</h4>
<p>Did you look at what it means to land the code <em>without</em> codegen changes?</p>



<a name="178699254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178699254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178699254">(Oct 21 2019 at 21:10)</a>:</h4>
<p>Presumably we have to introduce some feature gates</p>



<a name="178699274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178699274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178699274">(Oct 21 2019 at 21:11)</a>:</h4>
<p>I think we are also going to want to try and document the vtable formats</p>



<a name="178699310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178699310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178699310">(Oct 21 2019 at 21:11)</a>:</h4>
<p>I guess I need to spend a bit of time reviewing the PR again</p>



<a name="178700443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178700443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178700443">(Oct 21 2019 at 21:26)</a>:</h4>
<p>yep</p>



<a name="178700453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178700453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178700453">(Oct 21 2019 at 21:26)</a>:</h4>
<p>it's a real pain this eh</p>



<a name="178700462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178700462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178700462">(Oct 21 2019 at 21:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> feature gate with a warning message would be ideal</p>



<a name="178700464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178700464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178700464">(Oct 21 2019 at 21:26)</a>:</h4>
<p>that's no problem for me to do though</p>



<a name="178702370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178702370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178702370">(Oct 21 2019 at 21:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> vtable formats are pretty well-documented now I think. anyway I'll try to do this tonight or tomorrow... will leave looking at the codegen to you though. happy to chat about it again, but not sure I can offer much until an expert like you has a closer look!</p>



<a name="178702573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178702573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178702573">(Oct 21 2019 at 21:56)</a>:</h4>
<p>sounds good</p>



<a name="178773417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/178773417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#178773417">(Oct 22 2019 at 16:46)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> let us know if you have any thoughts on the above BTW :-)</p>



<a name="179869973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179869973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179869973">(Nov 04 2019 at 20:01)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> so what's the latest here?</p>



<a name="179870106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179870106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179870106">(Nov 04 2019 at 20:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> latest is very good. I got a few helpful tips from @eddyb to complete my implementation (it was working before, but a bit hacky). I basically need a proper test suite now. at least a minimal one, which can be expanded soon.</p>



<a name="179870121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179870121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179870121">(Nov 04 2019 at 20:02)</a>:</h4>
<p>a review either now or once we have a few more tests would be super.</p>



<a name="179870230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179870230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179870230">(Nov 04 2019 at 20:03)</a>:</h4>
<p>also trying to implement good diagnostics to suggest turning on the feature when trait upcasting is appropriate</p>



<a name="179870250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179870250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179870250">(Nov 04 2019 at 20:03)</a>:</h4>
<p>(i.e. only when a coercion is possible)</p>



<a name="179870633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179870633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179870633">(Nov 04 2019 at 20:07)</a>:</h4>
<p>Re. the second point: is there any way to get an appropriate <code>FnCtxt</code> from an <code>InferCtxt</code> in <code>rustc::infer::error_reporting</code> (specifically the <code>note_type_err</code> method)?</p>



<a name="179871307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179871307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179871307">(Nov 04 2019 at 20:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ^</p>



<a name="179871458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179871458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179871458">(Nov 04 2019 at 20:14)</a>:</h4>
<blockquote>
<p>a review either now or once we have a few more tests would be super.</p>
</blockquote>
<p>ok!</p>



<a name="179871475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179871475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179871475">(Nov 04 2019 at 20:14)</a>:</h4>
<blockquote>
<p>Re. the second point: is there any way to get an appropriate <code>FnCtxt</code> from an <code>InferCtxt</code> in <code>rustc::infer::error_reporting</code> (specifically the <code>note_type_err</code> method)?</p>
</blockquote>
<p>not sure what .. ah ok I see</p>



<a name="179871480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179871480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179871480">(Nov 04 2019 at 20:14)</a>:</h4>
<p>No, there is no way</p>



<a name="179871490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179871490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179871490">(Nov 04 2019 at 20:14)</a>:</h4>
<p>let me look what that method does</p>



<a name="179871699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179871699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179871699">(Nov 04 2019 at 20:16)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> oh, are you saying <em>from within that method</em>, you wish to get teh <code>FnCtxt</code>?</p>



<a name="179875403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179875403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179875403">(Nov 04 2019 at 20:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> sorry I didn't get a notification!</p>



<a name="179875405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179875405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179875405">(Nov 04 2019 at 20:55)</a>:</h4>
<p>hrmm</p>



<a name="179875457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179875457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179875457">(Nov 04 2019 at 20:56)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> right, that's what I want</p>



<a name="179875476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179875476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179875476">(Nov 04 2019 at 20:56)</a>:</h4>
<p>basically I want to see if type <code>a</code> is coercible to type <code>b</code> from within that method doing diagnostics</p>



<a name="179875488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179875488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179875488">(Nov 04 2019 at 20:56)</a>:</h4>
<p>and it needs the appropriate <code>FnCtxt</code> I guess</p>



<a name="179877178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179877178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179877178">(Nov 04 2019 at 21:12)</a>:</h4>
<p>Hmm. I think we should try to "not want" this</p>



<a name="179877181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179877181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179877181">(Nov 04 2019 at 21:12)</a>:</h4>
<p>Can you say more about why you want it?</p>



<a name="179879269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179879269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179879269">(Nov 04 2019 at 21:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> sure. basically when the diagnostic is emitted for "found type a... expected type b", I want to suggest "enable the trait_upcasting feature", but only when it's actually relevant</p>



<a name="179879321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179879321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179879321">(Nov 04 2019 at 21:37)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I could use a more simplistic algorithm of just looking at the expected and found traits (I'm given their DefIds already) and seeing if the expected trait is amongst the supertraits of the found traits... but that wouldn't account for type params and whatnot. good enough, still?</p>



<a name="179880441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179880441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179880441">(Nov 04 2019 at 21:49)</a>:</h4>
<p>seems good enough to me, <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span></p>



<a name="179882599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179882599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179882599">(Nov 04 2019 at 22:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> cool.</p>



<a name="179882633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/179882633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#179882633">(Nov 04 2019 at 22:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> as for tests... I'm going to write some tomorrow, but if you a) have ideas of ones to include, let me know, b) want to review soon anyway, both those things would be great. :-)</p>



<a name="180244436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180244436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180244436">(Nov 08 2019 at 16:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> writing tests lately, and encountered one problem (upcasting to an auto trait object):</p>
<div class="codehilite"><pre><span></span>67 |     let _: &amp;dyn Send = foo;
   |                        ^^^ expected trait `std::marker::Send`, found trait `Foo`
   |
   = note: expected type `&amp;dyn std::marker::Send`
              found type `&amp;dyn Foo`
</pre></div>


<p>when you do have time, which I appreciate may not be till next week, let me know your thoughts. the latest code (pretty much) is already pushed to Github.</p>



<a name="180244666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180244666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180244666">(Nov 08 2019 at 16:14)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> awesome</p>



<a name="180244675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180244675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180244675">(Nov 08 2019 at 16:14)</a>:</h4>
<p>I'm so excited for this to land</p>



<a name="180244696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180244696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180244696">(Nov 08 2019 at 16:14)</a>:</h4>
<p>In this case, do you have <code>trait Foo: Send</code>?</p>



<a name="180244722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180244722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180244722">(Nov 08 2019 at 16:15)</a>:</h4>
<p>I'm guessing this is an artifact of the semi-hokey way we handle auto traits</p>



<a name="180245064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180245064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180245064">(Nov 08 2019 at 16:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> exactly</p>



<a name="180245066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180245066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180245066">(Nov 08 2019 at 16:18)</a>:</h4>
<p>yeah</p>



<a name="180245071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180245071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180245071">(Nov 08 2019 at 16:18)</a>:</h4>
<p>probably that</p>



<a name="180249884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180249884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180249884">(Nov 08 2019 at 17:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> anyway if you think of a pointer as to what I should investigate for this, let me know. otherwise we'll chat next week.</p>



<a name="180442179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180442179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180442179">(Nov 11 2019 at 17:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Hey Niko. If you have a minute today, would you mind explaining this bit of code to me? (in <code>select.rs</code>)</p>



<a name="180442183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180442183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180442183">(Nov 11 2019 at 17:21)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="c1">// See `assemble_candidates_for_unsizing` for more info.</span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">existential_predicates</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">data_a</span><span class="p">.</span><span class="n">map_bound</span><span class="p">(</span><span class="o">|</span><span class="n">data_a</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="kd">let</span><span class="w"> </span><span class="n">iter</span><span class="w"> </span><span class="o">=</span><span class="w"></span>
<span class="w">                        </span><span class="n">data_a</span><span class="p">.</span><span class="n">principal</span><span class="p">().</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="n">x</span><span class="o">|</span><span class="w"> </span><span class="n">ty</span>::<span class="n">ExistentialPredicate</span>::<span class="n">Trait</span><span class="p">(</span><span class="n">x</span><span class="p">))</span><span class="w"></span>
<span class="w">                            </span><span class="p">.</span><span class="n">into_iter</span><span class="p">().</span><span class="n">chain</span><span class="p">(</span><span class="w"></span>
<span class="w">                                </span><span class="n">data_a</span><span class="w"></span>
<span class="w">                                    </span><span class="p">.</span><span class="n">projection_bounds</span><span class="p">()</span><span class="w"></span>
<span class="w">                                    </span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="n">x</span><span class="o">|</span><span class="w"> </span><span class="n">ty</span>::<span class="n">ExistentialPredicate</span>::<span class="n">Projection</span><span class="p">(</span><span class="n">x</span><span class="p">)),</span><span class="w"></span>
<span class="w">                            </span><span class="p">)</span><span class="w"></span>
<span class="w">                            </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="w"></span>
<span class="w">                                </span><span class="n">data_b</span><span class="w"></span>
<span class="w">                                    </span><span class="p">.</span><span class="n">auto_traits</span><span class="p">()</span><span class="w"></span>
<span class="w">                                    </span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="n">ty</span>::<span class="n">ExistentialPredicate</span>::<span class="n">AutoTrait</span><span class="p">),</span><span class="w"></span>
<span class="w">                            </span><span class="p">);</span><span class="w"></span>
<span class="w">                    </span><span class="n">tcx</span><span class="p">.</span><span class="n">mk_existential_predicates</span><span class="p">(</span><span class="n">iter</span><span class="p">)</span><span class="w"></span>
<span class="w">                </span><span class="p">});</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">source_ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">mk_dynamic</span><span class="p">(</span><span class="n">existential_predicates</span><span class="p">,</span><span class="w"> </span><span class="n">region_b</span><span class="p">);</span><span class="w"></span>
</pre></div>



<a name="180442245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180442245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180442245">(Nov 11 2019 at 17:22)</a>:</h4>
<p>specifically, why do we use b's auto-traits?</p>



<a name="180445800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180445800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180445800">(Nov 11 2019 at 18:09)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> looking now</p>



<a name="180446100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180446100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180446100">(Nov 11 2019 at 18:12)</a>:</h4>
<p>I think the answer to that question is because <code>b</code> is the target type, and we expect the autotraits to be a subset of <code>a</code>?</p>



<a name="180446114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180446114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180446114">(Nov 11 2019 at 18:13)</a>:</h4>
<p>let me find the code in question</p>



<a name="180446439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180446439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180446439">(Nov 11 2019 at 18:16)</a>:</h4>
<p>(yes, confirmed)</p>



<a name="180449898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180449898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180449898">(Nov 11 2019 at 19:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> right, makes sense, but that no longer applies now... which is why I think this is a problem</p>



<a name="180451252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180451252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180451252">(Nov 11 2019 at 19:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> maybe let's address this towards the end of the meeting :-)</p>



<a name="180451260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180451260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180451260">(Nov 11 2019 at 19:17)</a>:</h4>
<p>actually, I'll probably be away still</p>



<a name="180451265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180451265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180451265">(Nov 11 2019 at 19:17)</a>:</h4>
<p>but feel free to leave ideas</p>



<a name="180453437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180453437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180453437">(Nov 11 2019 at 19:40)</a>:</h4>
<blockquote>
<p>right, makes sense, but that no longer applies now... which is why I think this is a problem</p>
</blockquote>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> that seems true :)</p>



<a name="180456390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180456390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180456390">(Nov 11 2019 at 20:17)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> so that code is used to create <code>source_ty</code></p>



<a name="180456395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180456395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180456395">(Nov 11 2019 at 20:17)</a>:</h4>
<p>I think that code should move into the <code>else</code> branch</p>



<a name="180456422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180456422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180456422">(Nov 11 2019 at 20:17)</a>:</h4>
<p>i.e., you only need it if you have don't have trait-upcasting enabled</p>



<a name="180456436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180456436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180456436">(Nov 11 2019 at 20:17)</a>:</h4>
<p>the trait-upcasting branch can use the variable <code>source</code></p>



<a name="180456474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180456474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180456474">(Nov 11 2019 at 20:18)</a>:</h4>
<p>probably we should rename <code>source_ty</code>, too</p>



<a name="180456492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180456492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180456492">(Nov 11 2019 at 20:18)</a>:</h4>
<p>the creation of <code>source_ty</code> seems like it basically just a hack to relate (a) the lifetimes and (b) the other type arguments that may appear in the principle bound</p>



<a name="180468512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180468512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180468512">(Nov 11 2019 at 23:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> heh, that's exactly what I did just after I messaged you. sorry. but good to have confirmation!</p>



<a name="180468525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180468525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180468525">(Nov 11 2019 at 23:21)</a>:</h4>
<p>and yes, I renamed <code>source_ty</code> to just <code>source</code>, shadowing the existing <code>source</code> parameter</p>



<a name="180468528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180468528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180468528">(Nov 11 2019 at 23:21)</a>:</h4>
<p>which I think makes sense.</p>



<a name="180469220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469220">(Nov 11 2019 at 23:37)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span>  I would probably rename it to something like <code>source_eq_ty</code> or something, with a comment -- the current code is a bit... subtle</p>



<a name="180469230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469230">(Nov 11 2019 at 23:37)</a>:</h4>
<p>or <code>source_with_target_auto_traits</code> :)</p>



<a name="180469238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469238">(Nov 11 2019 at 23:37)</a>:</h4>
<p>I just finished reading the PR, it seems great so far</p>



<a name="180469262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469262">(Nov 11 2019 at 23:38)</a>:</h4>
<p>hah, that's verbose alright</p>



<a name="180469287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469287">(Nov 11 2019 at 23:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> cool. I just made that fix and reran tests BTW. upcasting with auto-traits working nicely now!</p>



<a name="180469292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469292">(Nov 11 2019 at 23:38)</a>:</h4>
<p><span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> =)</p>



<a name="180469300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469300">(Nov 11 2019 at 23:38)</a>:</h4>
<blockquote>
<p>hah, that's verbose alright</p>
</blockquote>
<p>heh, I'm a fan of verbose names for wacky edge cases... but in any case I think shadowing is misleading since these are not the same type</p>



<a name="180469310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469310">(Nov 11 2019 at 23:39)</a>:</h4>
<p>yeah you're right</p>



<a name="180469321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469321">(Nov 11 2019 at 23:39)</a>:</h4>
<p>I'll use that then!</p>



<a name="180469336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469336">(Nov 11 2019 at 23:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> what I'll do is try to add some more tests, then you can give it a final review whenever you can this week, maybe, and we can r+? :-)</p>



<a name="180469348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469348">(Nov 11 2019 at 23:39)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> yep, I think so :)</p>



<a name="180469397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469397">(Nov 11 2019 at 23:40)</a>:</h4>
<p>I would like to think about what rustc-guide additions are needed here, but I think it can come after the PR</p>



<a name="180469420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469420">(Nov 11 2019 at 23:40)</a>:</h4>
<p>great. I'll try to have that done by tomorrow (just in case you have the time tomorrow)</p>



<a name="180469424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469424">(Nov 11 2019 at 23:40)</a>:</h4>
<p>yeah</p>



<a name="180469427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469427">(Nov 11 2019 at 23:40)</a>:</h4>
<p>indeed</p>



<a name="180469437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469437">(Nov 11 2019 at 23:40)</a>:</h4>
<p>(I added a brief chapter to the unstable book in this PR of course.)</p>



<a name="180469936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180469936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180469936">(Nov 11 2019 at 23:52)</a>:</h4>
<p>anyway, thanks for the review. I'll try to address those comments tonight too, else tomorrow.</p>



<a name="180580876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180580876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180580876">(Nov 13 2019 at 01:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> so, tests all written now, but two outstanding issues:</p>
<ol>
<li>the diamond inheritance case doesn't work (segfaults), and I'm not sure why. see line 66 of the <code>diamond.rs</code> test. all other tests work however.</li>
<li>we're currently generating D S A metadata for auto traits, which seems wasteful. the naive approach of not including auto traits in the vtable construction (<code>meth.rs</code>) and in offset calculation (<code>select.rs</code>) does not work (it gives <a href="https://gist.github.com/94ee12b9d6aaf6cad24007d6e1024d83" target="_blank" title="https://gist.github.com/94ee12b9d6aaf6cad24007d6e1024d83">this ICE</a>)</li>
</ol>



<a name="180631293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180631293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180631293">(Nov 13 2019 at 14:30)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ok! great</p>



<a name="180631298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180631298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180631298">(Nov 13 2019 at 14:30)</a>:</h4>
<p>let me start a local build</p>



<a name="180631299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180631299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180631299">(Nov 13 2019 at 14:30)</a>:</h4>
<p>and investigate</p>



<a name="180632998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180632998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180632998">(Nov 13 2019 at 14:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> cool. thanks.</p>



<a name="180634659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180634659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180634659">(Nov 13 2019 at 15:05)</a>:</h4>
<p>ok I can reproduce the problems at least :)</p>



<a name="180657182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180657182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180657182">(Nov 13 2019 at 18:35)</a>:</h4>
<p>heh okay, good. let me know if you have ideas <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="180736174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736174">(Nov 14 2019 at 14:39)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> so i'm looking at the diamond case</p>



<a name="180736175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736175">(Nov 14 2019 at 14:39)</a>:</h4>
<p>I simplified the test file a lot</p>



<a name="180736260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736260">(Nov 14 2019 at 14:40)</a>:</h4>
<p><a href="https://gist.github.com/5a48395164357db543ffe03838a4e6e2" target="_blank" title="https://gist.github.com/5a48395164357db543ffe03838a4e6e2">my simplified test</a></p>



<a name="180736266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736266">(Nov 14 2019 at 14:40)</a>:</h4>
<p>this still crashes</p>



<a name="180736271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736271">(Nov 14 2019 at 14:40)</a>:</h4>
<p>the LLVM output is .. basically illegible :)</p>



<a name="180736288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736288">(Nov 14 2019 at 14:40)</a>:</h4>
<p>I guess the next step is either to try and format the LLVM IR and make sense of it or else to insert debug statements to try and log what's going on</p>



<a name="180736306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736306">(Nov 14 2019 at 14:40)</a>:</h4>
<p>I mean it seems pretty obvious that <em>something</em> is off, but I can't quite figure out what is being generated yet to tell <em>what</em></p>



<a name="180736341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736341">(Nov 14 2019 at 14:41)</a>:</h4>
<p>I would guess that the methods from <code>Foo</code> need to be duplicated across the table</p>



<a name="180736342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736342">(Nov 14 2019 at 14:41)</a>:</h4>
<p>and that they are not</p>



<a name="180736361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736361">(Nov 14 2019 at 14:41)</a>:</h4>
<p>probably because when we are enumerating the set of supertraits etc we are avoiding walking the same thing twice</p>



<a name="180736373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180736373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180736373">(Nov 14 2019 at 14:41)</a>:</h4>
<p>but we need to if we are going to use this vtable generation strategy</p>



<a name="180747554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180747554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180747554">(Nov 14 2019 at 16:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yes I think you're spot on.</p>



<a name="180749609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180749609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180749609">(Nov 14 2019 at 16:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> and thanks for investigating!</p>



<a name="180750211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180750211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180750211">(Nov 14 2019 at 16:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I wonder... what cases <em>precisely</em> I need to duplicate (some of) the supertraits in. probably just diamond inheritance?</p>



<a name="180906352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180906352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180906352">(Nov 16 2019 at 10:13)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I think all of them</p>



<a name="180906355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180906355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180906355">(Nov 16 2019 at 10:13)</a>:</h4>
<p>that's the whole point with this style -- you have to make a tree, not a DAG</p>



<a name="180906860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180906860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180906860">(Nov 16 2019 at 10:29)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ps, my desktop where I had checkouts of your branch and everything mysteriously died a horrific death yesterday, so I can't play with your code right now</p>



<a name="180906862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180906862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180906862">(Nov 16 2019 at 10:29)</a>:</h4>
<p>But I do think you have to de-duplicate everything</p>



<a name="180906870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180906870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180906870">(Nov 16 2019 at 10:29)</a>:</h4>
<p>Put another way, the trait should have one complete copy of the vtables for each of its supertraits</p>



<a name="180906871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180906871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180906871">(Nov 16 2019 at 10:29)</a>:</h4>
<p>if you have <code>trait Foo: Bar + Bar</code>, then you don't need two copies of <code>Bar</code></p>



<a name="180906920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180906920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180906920">(Nov 16 2019 at 10:30)</a>:</h4>
<p>but if you have trait <code>Foo: Bar1 + Bar2</code> and <code>trait Bar1: Baz</code> / <code>trait Bar2: Baz</code>, you need a copy of <code>Bar1</code> and <code>Bar2</code>, and they <em>each</em> need a copy of <code>Baz</code></p>



<a name="180928531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180928531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180928531">(Nov 16 2019 at 21:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> oh dear! well, thanks for trying to investigate anyway</p>



<a name="180928577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180928577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180928577">(Nov 16 2019 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> can I can only deduplicate if the type args are the same though right?</p>



<a name="180928764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180928764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180928764">(Nov 16 2019 at 21:17)</a>:</h4>
<p>The thing that perplexed me is: how come you can call supertrait methods in the current vtable setup, if I'm not doing it the right way?</p>



<a name="180928902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180928902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180928902">(Nov 16 2019 at 21:21)</a>:</h4>
<p>^ hmm, presumably because we go up the type hierarchy as we offset into the vtable, right <span class="user-mention" data-user-id="116009">@nikomatsakis</span> ?</p>



<a name="180928941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180928941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180928941">(Nov 16 2019 at 21:22)</a>:</h4>
<p>so we don't want to duplicate <em>everything</em> then</p>



<a name="180936386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180936386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180936386">(Nov 17 2019 at 01:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> so, I was thinking about this more today and looking at some debug output, and I believe we don't actually need multiple copies of the vtables for the same supertrait <em>at all</em>. the problem stems from the fact that in the diamond test case, the supertraits are enumerated in the order <code>Baz, Bar2, Foo, Bar1</code>. I think this is because it does a depth-first visit, but the real point is the order isn't suitable if you offset to <code>Bar1</code>'s vtable and then try to access a method of <code>Foo</code> (which should be legal). see the problem? if we had the order <code>Baz, Bar2, Bar1, Foo</code>, all would be fine! (<code>Bar1, Bar2</code> is equally good, of course.) now, since the trait hierarchy forms a DAG, we're in luck. we can just do a topological sort on the supertraits and the resulting overall vtable will be properly "offsetable" no matter what sequence of upcasts you do. I think we just need to be careful that we consider the different <code>PolyTraitRef</code>s (modulo lifetimes?) return by <code>supertraits</code> as different 'vertices' in the top-sort.</p>



<a name="180936503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180936503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180936503">(Nov 17 2019 at 01:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I mean, this has the issue that if we upcast <code>Baz -&gt; Bar2</code> we somehow have to know to skip over <code>Bar1</code> in the above example when finding the necessary method offset in <code>Foo</code>... since <code>Bar1</code> isn't a supertrait of Bar2` of course, the normal "supertrait counting" thing won't work, but maybe we can create a look-up table or something?</p>



<a name="180936553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180936553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180936553">(Nov 17 2019 at 01:24)</a>:</h4>
<p>I believe what you were suggesting (while it obviously works) requires a change to the "supertrait counting" algorithm for finding method offsets, anyway</p>



<a name="180936555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/180936555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#180936555">(Nov 17 2019 at 01:24)</a>:</h4>
<p>well, let me know your thoughts :-)</p>



<a name="181053931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181053931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181053931">(Nov 18 2019 at 20:45)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I don't understand your suggestion</p>



<a name="181053937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181053937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181053937">(Nov 18 2019 at 20:45)</a>:</h4>
<p>If you have <code>Baz, Bar2, Bar1, Foo</code></p>



<a name="181053942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181053942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181053942">(Nov 18 2019 at 20:45)</a>:</h4>
<p>and you try to upcast to <code>Bar1</code>, you're all set (sort of)</p>



<a name="181053950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181053950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181053950">(Nov 18 2019 at 20:45)</a>:</h4>
<p>but if you try to upcast to <code>Bar2</code>, you're not</p>



<a name="181053960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181053960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181053960">(Nov 18 2019 at 20:45)</a>:</h4>
<p>that is, the <code>Bar2</code> vtable expects <code>Bar2, Foo</code></p>



<a name="181053968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181053968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181053968">(Nov 18 2019 at 20:46)</a>:</h4>
<p>and the <code>Bar1</code> vtable expects <code>Bar1, Foo</code></p>



<a name="181054018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181054018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181054018">(Nov 18 2019 at 20:46)</a>:</h4>
<p>therefore, there is no way to have <em>both</em> a <code>Bar1</code> and a <code>Bar2</code> vtable embedded without two copies of <code>Foo</code></p>



<a name="181056308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181056308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181056308">(Nov 18 2019 at 21:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> but that's the thing... does the <code>Bar1</code> vtable need to expect <code>Bar1, Foo</code>? I thought it could just expect <code>Bar1, X, Foo</code> if we accommodate for that?</p>



<a name="181074247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181074247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181074247">(Nov 19 2019 at 01:34)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> eh, no, I'm an idiot... that isn't possible because the method offsets all have to be fixed at compile-time, and be the same for all types implementing a given trait, right?</p>



<a name="181074406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181074406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181074406">(Nov 19 2019 at 01:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> anyway, I think the solution here is to have something like the <code>supertraits</code> query (that performs a DFS), but allow visiting the same trait twice, at different points in the search. the question is: is infinite recursion still possible? I don't know in precisely what cases it occurs... is it just with auto traits? cf. <code>src/librustc/traits/util.rs:135</code></p>



<a name="181145403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181145403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181145403">(Nov 19 2019 at 19:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> anyway if that now makes sense to you, let me know how you think we should implement it, and I'll try to get on it ASAP</p>



<a name="181331072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181331072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181331072">(Nov 21 2019 at 18:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> just checking you saw the above message... no problem if you're too busy to address it today!</p>



<a name="181597975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181597975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181597975">(Nov 22 2019 at 00:04)</a>:</h4>
<p>oh, also, if you have any idea about the auto-traits thing, would be great...</p>



<a name="181660928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181660928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181660928">(Nov 22 2019 at 17:46)</a>:</h4>
<p>heading out now for the evening, but feel free to leave notes/idea here :-)</p>



<a name="181673643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181673643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181673643">(Nov 22 2019 at 20:19)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> anyway, I think the solution here is to have something like the <code>supertraits</code> query (that performs a DFS), but allow visiting the same trait twice, at different points in the search. the question is: is infinite recursion still possible? I don't know in precisely what cases it occurs... is it just with auto traits? cf. <code>src/librustc/traits/util.rs:135</code></p>
</blockquote>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> this sounds correct</p>



<a name="181673694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181673694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181673694">(Nov 22 2019 at 20:20)</a>:</h4>
<p>I don't believe infinite recursion should be possible at that late stage</p>



<a name="181673706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181673706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181673706">(Nov 22 2019 at 20:20)</a>:</h4>
<p>because earlier stages already check that supertraits are a  DAG</p>



<a name="181673726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181673726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181673726">(Nov 22 2019 at 20:20)</a>:</h4>
<p>so presumably we need some second "enumerator" that will run -- I think it'd be <em>safest</em> if it only runs during codegen</p>



<a name="181691475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/181691475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#181691475">(Nov 23 2019 at 00:47)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yep, thoughts were my thoughts too. thanks. I may be able to reuse some of the underlying machinery for the computation of supertraits. I wonder if it's necessary make this new 'enumerator' an actual query though?</p>



<a name="192835898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/192835898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#192835898">(Apr 03 2020 at 17:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> is there any update on this? I'm considering closing <a href="https://github.com/rust-lang/rust/pull/60900" title="https://github.com/rust-lang/rust/pull/60900">https://github.com/rust-lang/rust/pull/60900</a> right now <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="192836763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/192836763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#192836763">(Apr 03 2020 at 17:17)</a>:</h4>
<p><span class="user-mention" data-user-id="120823">@DPC</span> <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> and I were discussing that the PR needs to be refactored. They mentioned they were going to try, I'm not sure if they've had a chance yet. I think closing the PR is not unreasonable, though, as hopefully there will be a smaller on that does some of the initial work and then follow-up PRs.</p>



<a name="242677272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242677272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242677272">(Jun 15 2021 at 01:05)</a>:</h4>
<p>I'm currently reviving this work, since it's a very useful feature, and the implementation doesn't seem very hard.</p>



<a name="242677373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242677373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242677373">(Jun 15 2021 at 01:07)</a>:</h4>
<p>I've created and posted the initial two PRs, <a href="https://github.com/rust-lang/rust/issues/86264">#86264</a> (typecheck and feature gate) and <a href="https://github.com/rust-lang/rust/issues/86291">#86291</a> (codegen refactoring as preparation), they're decoupled and can be landed separately.</p>



<a name="242677564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242677564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242677564">(Jun 15 2021 at 01:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> If you've got some bandwidth would you minding taking a look at <a href="https://github.com/rust-lang/rust/issues/86264">#86264</a> ? It's a small change verifying the "compatibilty" of two principal traits of trait objects during the unsizing operation.</p>



<a name="242782973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242782973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242782973">(Jun 15 2021 at 19:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span> I'm thrilled about that</p>



<a name="242783020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242783020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242783020">(Jun 15 2021 at 19:02)</a>:</h4>
<p>but I think we should put it on the lang team project board</p>



<a name="242783031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242783031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242783031">(Jun 15 2021 at 19:02)</a>:</h4>
<p>how would you feel about creating a project proposal ?</p>



<a name="242783039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242783039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242783039">(Jun 15 2021 at 19:02)</a>:</h4>
<p>I'd second it</p>



<a name="242788809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242788809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242788809">(Jun 15 2021 at 19:45)</a>:</h4>
<p>Sure, <a href="https://github.com/rust-lang/lang-team/issues/98">https://github.com/rust-lang/lang-team/issues/98</a></p>



<a name="242789484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242789484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242789484">(Jun 15 2021 at 19:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="242790799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242790799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242790799">(Jun 15 2021 at 20:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span> great, thanks!</p>



<a name="242790835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242790835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242790835">(Jun 15 2021 at 20:00)</a>:</h4>
<p>also, can you add a link to the PR that was closed from before, <span class="user-mention" data-user-id="116458">@Charles Lew</span> ?</p>



<a name="242790869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242790869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242790869">(Jun 15 2021 at 20:00)</a>:</h4>
<p>I was a bit surprised by some of the upcasting logic in <a href="https://github.com/rust-lang/rust/issues/86264">#86264</a> -- comparing for equality seems a bit suspicious</p>



<a name="242790883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242790883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242790883">(Jun 15 2021 at 20:00)</a>:</h4>
<p>not <em>wrong</em></p>



<a name="242790984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242790984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242790984">(Jun 15 2021 at 20:01)</a>:</h4>
<p>I added that to the tracking issue before. The tracking issue is linked from the proposal. Do you want a separate copy in the project proposal?</p>



<a name="242791563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242791563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242791563">(Jun 15 2021 at 20:05)</a>:</h4>
<p>Now that i think more about it, it is a little suspicious.</p>



<a name="242791753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242791753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242791753">(Jun 15 2021 at 20:06)</a>:</h4>
<p><del>The replaced previous code was just comparing <code>def_id</code>. So maybe there would be cases where the <code>def_id</code> matched but the substs doesn't really match, and maybe that would be unsound?</del></p>



<a name="242791843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242791843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242791843">(Jun 15 2021 at 20:07)</a>:</h4>
<p><del>The new code i wrote directly compares the trait ref, and i think this might reject legal code somehow...</del></p>



<a name="242796072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242796072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242796072">(Jun 15 2021 at 20:38)</a>:</h4>
<p>nevermind, there's more follow up checks in <code>confirm_builtin_unsize_candidate</code> so these two parts needs to work together.</p>



<a name="242799162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/242799162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#242799162">(Jun 15 2021 at 21:01)</a>:</h4>
<p>In fact, it seems the logic in <code>confirm_builtin_unsize_candidate</code> is mostly all we want. (I don't know why it leaves the part of  auto trait checking to <code>assemble_candidates_for_unsizing</code> though)</p>
<p>I guess the proper implementation is just removing the principal trait identical test, leaving that check to <code>At::sup</code> within <code>confirm_builtin_unsize_candidate</code>. (Not sure whether i should also move the auto traits to the confirmation stage)</p>
<p>With this said, the feature gate checking is not easily done within the obligation engine. Maybe i'll duplicate the logic and leave the feature gating part within the <code>assemble_candidates_for_unsizing</code> function.</p>



<a name="243245752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243245752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243245752">(Jun 19 2021 at 11:46)</a>:</h4>
<hr>



<a name="243245757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243245757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243245757">(Jun 19 2021 at 11:46)</a>:</h4>
<p>Update: Codegen refactor pr <a href="https://github.com/rust-lang/rust/issues/86291">#86291</a> was merged and, third PR <a href="https://github.com/rust-lang/rust/issues/86461">#86461</a> is up, which refactors the vtable to use the new scheme.</p>



<a name="243246193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243246193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243246193">(Jun 19 2021 at 11:57)</a>:</h4>
<p>ideally we'd first deduplicate codegen and miri vtable generation by always going through miri</p>



<a name="243246196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243246196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243246196">(Jun 19 2021 at 11:57)</a>:</h4>
<p>then we'd only have a single site. we've been wanting to do that since a while, and I think recently someone was working on it, but I can't remember details</p>



<a name="243246246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243246246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243246246">(Jun 19 2021 at 11:58)</a>:</h4>
<p>That's fine. I have to understand the details anyway. Maybe i'll start with the miri part.</p>



<a name="243246321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243246321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243246321">(Jun 19 2021 at 12:00)</a>:</h4>
<p>For the feature of <code>trait_upcasting</code> I think there're two things left: One is typecheck changes, previously a pr is up but there's something wrong with it so i think it'll get it right with <span class="user-mention" data-user-id="116009">@nikomatsakis</span> 's help when GAT/TAIT work is not so busy.</p>



<a name="243246331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243246331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243246331">(Jun 19 2021 at 12:00)</a>:</h4>
<p>The other thing will be actually changing the pointer conversion behavior.</p>



<a name="243246350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243246350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243246350">(Jun 19 2021 at 12:01)</a>:</h4>
<p>Basically it will be changing the fat pointer =&gt; fat pointer conversion.</p>



<a name="243246361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243246361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243246361">(Jun 19 2021 at 12:01)</a>:</h4>
<p>Previously @alexreg 's PR doesn't cover this part at all, only a few changes to llvm codegen. But i guess i'll start from miri side.  <span class="user-mention" data-user-id="120791">@RalfJ</span></p>



<a name="243248619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243248619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243248619">(Jun 19 2021 at 12:51)</a>:</h4>
<p>Yes? :)</p>



<a name="243250644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243250644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243250644">(Jun 19 2021 at 13:42)</a>:</h4>
<p>I'm totally unfamiliar with miri code =) So i guess it'll take a few days before i start asking questions. Basically about pointer-cast unsizing.</p>



<a name="243250698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243250698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243250698">(Jun 19 2021 at 13:44)</a>:</h4>
<p>Before that i want to ask a small question about previous comments from bjorn3 in this issue: <a href="https://github.com/rust-lang/rust/issues/86324">https://github.com/rust-lang/rust/issues/86324</a></p>



<a name="243250766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243250766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243250766">(Jun 19 2021 at 13:46)</a>:</h4>
<p>The comment was about </p>
<blockquote>
<p>create an Allocation outside of the context of a Machine</p>
</blockquote>



<a name="243250780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243250780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243250780">(Jun 19 2021 at 13:46)</a>:</h4>
<p>I'm curious why is this possible... Since vtable includes pointers to functions and other vtables...</p>



<a name="243250803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243250803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243250803">(Jun 19 2021 at 13:47)</a>:</h4>
<p>Also, is there some introduction materials like <code>rustc-dev-guide</code> but about miri?  <span class="user-mention" data-user-id="120791">@RalfJ</span></p>



<a name="243257208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243257208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243257208">(Jun 19 2021 at 16:27)</a>:</h4>
<p>Pointers to functions are represented by <code>AllocId</code>'s that point to a <code>GlobalAlloc::Function</code>. For vtable pointers it would be backed by <code>GlobalAlloc::Memory</code>. <code>AllocId</code>'s can be allocated in both a <code>Machine</code> or <code>tcx.alloc_map</code>. Currently miri's vtable generation allocates them in a <code>Machine</code>. The goal is to allocate them in <code>tcx.alloc_map</code> instead using <code>tcx.create_memory_alloc</code>.</p>



<a name="243257212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243257212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243257212">(Jun 19 2021 at 16:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span></p>



<a name="243257318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243257318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243257318">(Jun 19 2021 at 16:29)</a>:</h4>
<p>So is it something that "records" all write operations to a piece of "memory allocation"?</p>



<a name="243257482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243257482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243257482">(Jun 19 2021 at 16:33)</a>:</h4>
<p>No, you would make a full <code>Allocation</code> and then call <code>tcx.create_memory_alloc(tcx.intern_allocation(alloc))</code> to get an <code>AllocId</code> to the now immutable allocation..</p>



<a name="243258087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243258087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243258087">(Jun 19 2021 at 16:47)</a>:</h4>
<p>Sounds good, let me try to see if i get it right.</p>



<a name="243259628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243259628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243259628">(Jun 19 2021 at 17:20)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I made some progress. Though i still haven't get how to convert <code>AllocId</code> to <code>Scalar</code> ...</p>



<a name="243259744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243259744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243259744">(Jun 19 2021 at 17:22)</a>:</h4>
<p>Oh, i think i figured it out... there's a <code>Pointer</code> intermediate type.</p>



<a name="243259941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243259941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243259941">(Jun 19 2021 at 17:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/object.20upcasting/near/243250803">said</a>:</p>
<blockquote>
<p>Also, is there some introduction materials like <code>rustc-dev-guide</code> but about miri?  <span class="user-mention silent" data-user-id="120791">RalfJ</span></p>
</blockquote>
<p>well, there is <a href="https://rustc-dev-guide.rust-lang.org/miri.html">https://rustc-dev-guide.rust-lang.org/miri.html</a>. it should even be mostly up-to-date...</p>



<a name="243260043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243260043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243260043">(Jun 19 2021 at 17:29)</a>:</h4>
<p>I am also a bit confused about what you are trying to achieve. it seems there are two things:</p>
<ul>
<li>using miri to generate all vtables. the code for that already exists and you have touched it; the issue here is wiring this up with the codegen backends in the right way. I'm afraid I am the wrong person to ask for this; the stuff that glues miri to the rest of rustc is not really my area of expertise...</li>
<li>implementing the unsizing casts in miri. this is not a blocker for implementing them elsewhere, but I try to keep miri feature-complete wrt to codegen (we currently lack arbitrary-<code>self</code> receivers in <code>dyn</code> types but other than that, miri is complete, I think).  I assume these are reference-to-reference casts so the right place to start is probably <a href="https://github.com/rust-lang/rust/blob/44a8e8d7455cd8f8ec3b3f2d5d4ef80693608f63/compiler/rustc_mir/src/interpret/cast.rs#L27">around here</a></li>
</ul>



<a name="243284298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/243284298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#243284298">(Jun 20 2021 at 03:52)</a>:</h4>
<p>Thanks!</p>



<a name="244513865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/244513865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#244513865">(Jul 01 2021 at 03:13)</a>:</h4>
<p>Status update:</p>
<p>These two preparation PRs has landed:</p>
<ul>
<li>Refactor vtable codegen <a href="https://github.com/rust-lang/rust/issues/86291">#86291</a></li>
<li>Change vtable memory representation to use tcx allocated allocations. <a href="https://github.com/rust-lang/rust/issues/86475">#86475</a></li>
</ul>



<a name="244513920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/244513920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#244513920">(Jul 01 2021 at 03:14)</a>:</h4>
<p>Third PR:</p>
<ul>
<li>Refactor vtable format for upcoming trait_upcasting feature. <a href="https://github.com/rust-lang/rust/issues/86461">#86461</a><br>
is ready for review.</li>
</ul>



<a name="244655948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/244655948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#244655948">(Jul 02 2021 at 03:23)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span>  about <a href="https://github.com/rust-lang/rust/issues/86461">#86461</a> , do you want to review it, or do you want me to pass it to <span class="user-group-mention" data-user-group-id="692">@WG-traits</span> for reviewing?</p>



<a name="244661512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/244661512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#244661512">(Jul 02 2021 at 05:41)</a>:</h4>
<p>I did a quick review. I would like to pass the rest of the review to <span class="user-group-mention" data-user-group-id="692">@WG-traits</span> as I am not familiar enough with this area of the compiler.</p>



<a name="246712308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246712308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246712308">(Jul 21 2021 at 12:33)</a>:</h4>
<p>office hour slot in 1hr   :)    <span class="user-mention" data-user-id="116009">@nikomatsakis</span>  would you mind using this Zulip topic?</p>



<a name="246719567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719567">(Jul 21 2021 at 13:32)</a>:</h4>
<p>no problem!</p>



<a name="246719571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719571">(Jul 21 2021 at 13:32)</a>:</h4>
<p>I'm here</p>



<a name="246719580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719580">(Jul 21 2021 at 13:32)</a>:</h4>
<p>thanks!</p>



<a name="246719624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719624">(Jul 21 2021 at 13:32)</a>:</h4>
<p>Did you want to talk about <a href="https://github.com/rust-lang/rust/issues/86461">#86461</a> ?</p>



<a name="246719643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719643">(Jul 21 2021 at 13:32)</a>:</h4>
<p>yes!</p>



<a name="246719655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719655">(Jul 21 2021 at 13:32)</a>:</h4>
<p>I've read it over once</p>



<a name="246719663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719663">(Jul 21 2021 at 13:32)</a>:</h4>
<p>Let me look back over it</p>



<a name="246719715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719715">(Jul 21 2021 at 13:33)</a>:</h4>
<p>oh, this testing infra is beautful</p>



<a name="246719740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719740">(Jul 21 2021 at 13:33)</a>:</h4>
<p>did you have specific questions or things you wanted to discuss?</p>



<a name="246719759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719759">(Jul 21 2021 at 13:33)</a>:</h4>
<p>otherwise I can read and poke you with questions :) I see <span class="user-mention" data-user-id="119009">@eddyb</span> left a comment</p>



<a name="246719823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246719823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246719823">(Jul 21 2021 at 13:34)</a>:</h4>
<p>i think you can go ahead and read it first.</p>



<a name="246720014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720014">(Jul 21 2021 at 13:35)</a>:</h4>
<p>I still want to ask about whether it's ok to use <code>ParamEnv::reveal_all()</code> here... I think since the types are "concrete" enough, maybe it's ok?</p>



<a name="246720278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720278">(Jul 21 2021 at 13:37)</a>:</h4>
<p>ok so</p>



<a name="246720287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720287">(Jul 21 2021 at 13:38)</a>:</h4>
<p>the logic of the vtable layout makes sense, very cool</p>



<a name="246720304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720304">(Jul 21 2021 at 13:38)</a>:</h4>
<p>the testing makes sense</p>



<a name="246720368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720368">(Jul 21 2021 at 13:38)</a>:</h4>
<p>I would love to see each of your examples as a test, or at least this monster one</p>



<a name="246720392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720392">(Jul 21 2021 at 13:38)</a>:</h4>
<div class="codehilite"><pre><span></span><code>    // For a more complex inheritance relationship like this:
    //   O --&gt; G --&gt; C --&gt; A
    //     \     \     \-&gt; B
    //     |     |-&gt; F --&gt; D
    //     |           \-&gt; E
    //     |-&gt; N --&gt; J --&gt; H
    //           \     \-&gt; I
    //           |-&gt; M --&gt; K
    //                 \-&gt; L
    // The resulting vtable will consists of these segments:
    //  DSA, A, B, B-vptr, C, D, D-vptr, E, E-vptr, F, F-vptr, G,
    //  H, H-vptr, I, I-vptr, J, J-vptr, K, K-vptr, L, L-vptr, M, M-vptr,
    //  N, N-vptr, O
</code></pre></div>



<a name="246720407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720407">(Jul 21 2021 at 13:38)</a>:</h4>
<p>yes, i can add it :)</p>



<a name="246720419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720419">(Jul 21 2021 at 13:38)</a>:</h4>
<p>I didn't read the loop and definition in detail</p>



<a name="246720452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720452">(Jul 21 2021 at 13:39)</a>:</h4>
<p>tbh I think that having the test would give me more confidence in its correctness than me reading it :)</p>



<a name="246720467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720467">(Jul 21 2021 at 13:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/object.20upcasting/near/246720014">said</a>:</p>
<blockquote>
<p>I still want to ask about whether it's ok to use <code>ParamEnv::reveal_all()</code> here... I think since the types are "concrete" enough, maybe it's ok?</p>
</blockquote>
<p>where precisely do you mean</p>



<a name="246720535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720535">(Jul 21 2021 at 13:39)</a>:</h4>
<p>one thing that is missing from the "monster" test</p>



<a name="246720556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720556">(Jul 21 2021 at 13:39)</a>:</h4>
<p>is any chain of single inheritance</p>



<a name="246720628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720628">(Jul 21 2021 at 13:40)</a>:</h4>
<p>I think a good test might be</p>



<a name="246720723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720723">(Jul 21 2021 at 13:40)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/86461/files#diff-64ba6669d816a72d0c001062233739d967f0cc66938c6e934f4d947ceea33337R65">https://github.com/rust-lang/rust/pull/86461/files#diff-64ba6669d816a72d0c001062233739d967f0cc66938c6e934f4d947ceea33337R65</a><br>
This one^</p>
<p>And<br>
<a href="https://github.com/rust-lang/rust/pull/86461/files#diff-b81e352311722abf2e93dff8b5af345f3a434adf9c7c068b17de9c815ec114d7R688">https://github.com/rust-lang/rust/pull/86461/files#diff-b81e352311722abf2e93dff8b5af345f3a434adf9c7c068b17de9c815ec114d7R688</a></p>



<a name="246720727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720727">(Jul 21 2021 at 13:40)</a>:</h4>
<div class="codehilite"><pre><span></span><code>A -&gt; B -&gt; C
|
D -&gt; E -&gt; F
     \---&gt; G --&gt; H
</code></pre></div>



<a name="246720735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720735">(Jul 21 2021 at 13:40)</a>:</h4>
<p>something like that</p>



<a name="246720759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720759">(Jul 21 2021 at 13:40)</a>:</h4>
<p>Sure, i'll add this as another test.</p>



<a name="246720806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720806">(Jul 21 2021 at 13:41)</a>:</h4>
<p>because then we can see that, indeed, the B and C are adjacent, and you have an "isa" relationship between A, B, and C</p>



<a name="246720828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720828">(Jul 21 2021 at 13:41)</a>:</h4>
<p>and between D, E, F, etc</p>



<a name="246720871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720871">(Jul 21 2021 at 13:41)</a>:</h4>
<p>I guess maybe that's still observable, I just thought the monster test never resulted in any output like <code>A B C</code> where there was an is-a relationship between them</p>



<a name="246720877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720877">(Jul 21 2021 at 13:41)</a>:</h4>
<p><em>anyway</em></p>



<a name="246720885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720885">(Jul 21 2021 at 13:41)</a>:</h4>
<p>as to reveal-all:</p>



<a name="246720975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720975">(Jul 21 2021 at 13:42)</a>:</h4>
<p>those lnks dont' work for me :(</p>



<a name="246720980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720980">(Jul 21 2021 at 13:42)</a>:</h4>
<p>but I will try searching :)</p>



<a name="246720989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246720989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246720989">(Jul 21 2021 at 13:42)</a>:</h4>
<p>Oops</p>



<a name="246721017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721017">(Jul 21 2021 at 13:42)</a>:</h4>
<p>yeah, they're truncated somehow</p>



<a name="246721029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721029">(Jul 21 2021 at 13:42)</a>:</h4>
<p>I presume that this vtable construction logic runs only in the very back-end of the compiler?</p>



<a name="246721034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721034">(Jul 21 2021 at 13:42)</a>:</h4>
<p>codegen?</p>



<a name="246721049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721049">(Jul 21 2021 at 13:42)</a>:</h4>
<p>(what we used to call <code>trans</code>...)</p>



<a name="246721107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721107">(Jul 21 2021 at 13:43)</a>:</h4>
<p>yeah, indeed.</p>



<a name="246721119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721119">(Jul 21 2021 at 13:43)</a>:</h4>
<p>then reveal-all is fine</p>



<a name="246721142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721142">(Jul 21 2021 at 13:43)</a>:</h4>
<p>that is an appropriate time to reveal all, basically</p>



<a name="246721145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721145">(Jul 21 2021 at 13:43)</a>:</h4>
<p>all the uses I saw looked ok</p>



<a name="246721241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721241">(Jul 21 2021 at 13:44)</a>:</h4>
<p>If CTFE use it in a later time, is reveal all still ok?</p>



<a name="246721357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721357">(Jul 21 2021 at 13:45)</a>:</h4>
<p>I think so, I'm pondering</p>



<a name="246721386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721386">(Jul 21 2021 at 13:46)</a>:</h4>
<p>how/when would CTFE use it?</p>



<a name="246721418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721418">(Jul 21 2021 at 13:46)</a>:</h4>
<p>to model <code>dyn Trait</code> values?</p>



<a name="246721442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721442">(Jul 21 2021 at 13:46)</a>:</h4>
<p>yeah</p>



<a name="246721480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721480">(Jul 21 2021 at 13:46)</a>:</h4>
<p>it's an interesting question but it must be ok</p>



<a name="246721505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721505">(Jul 21 2021 at 13:46)</a>:</h4>
<p>ok, cool</p>



<a name="246721514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721514">(Jul 21 2021 at 13:46)</a>:</h4>
<p>presumably specializations down the line etc canot change the methods that get called</p>



<a name="246721525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721525">(Jul 21 2021 at 13:46)</a>:</h4>
<p>for <code>dyn</code> values that are created <em>in this crate</em></p>



<a name="246721556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721556">(Jul 21 2021 at 13:47)</a>:</h4>
<p>or else something went wrong in our design :)</p>



<a name="246721590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721590">(Jul 21 2021 at 13:47)</a>:</h4>
<p>thanks :)</p>



<a name="246721622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721622">(Jul 21 2021 at 13:47)</a>:</h4>
<p>do you believe this PR is ready to land?</p>



<a name="246721635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721635">(Jul 21 2021 at 13:47)</a>:</h4>
<p>(apart from maybe a test or two being added)</p>



<a name="246721651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721651">(Jul 21 2021 at 13:47)</a>:</h4>
<p>that is, it looks like you already addressed <span class="user-mention" data-user-id="119009">@eddyb</span>'s comment</p>



<a name="246721669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721669">(Jul 21 2021 at 13:47)</a>:</h4>
<p>I think so, it doesn't change program behavior.</p>



<a name="246721876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246721876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246721876">(Jul 21 2021 at 13:49)</a>:</h4>
<p>The vtable will grow a little for program that uses complex trait inheritance, but that won't hurt i guess :)</p>



<a name="246722172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246722172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246722172">(Jul 21 2021 at 13:51)</a>:</h4>
<p>ok. I'm going to leave a comment suggesting a few tests but with r=me</p>



<a name="246722357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246722357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246722357">(Jul 21 2021 at 13:53)</a>:</h4>
<p>thanks!</p>



<a name="246722662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246722662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246722662">(Jul 21 2021 at 13:55)</a>:</h4>
<p>I'm very excited you're picking this up</p>



<a name="246722981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246722981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246722981">(Jul 21 2021 at 13:57)</a>:</h4>
<p>I'm also taking it as a chance to learn more about the traits system. I hope i can get to understand the trait system implementation better when you're back from vacation :) I'll book another office hour at that time.</p>



<a name="246850687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246850687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246850687">(Jul 22 2021 at 14:01)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="116458">@Charles Lew</span>, <span class="user-mention" data-user-id="418083">@Alexa VanHattum</span> was asking me the following and I thought you would be better positioned to answer:</p>
<blockquote>
<p>It looks like it's still the case that the index <code>idx</code> passed at call site from <code>InstanceDef::Virtual(def_id, idx)</code> will always correspond to the index into the slice returned by fn <code>vtable_entries</code> , since the segments are built in there, right? Otherwise, would it make sense for <code>VtblEntry::Method</code> to include that index as well?</p>
</blockquote>



<a name="246857652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246857652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246857652">(Jul 22 2021 at 14:51)</a>:</h4>
<p><span class="user-mention" data-user-id="418083">@Alexa VanHattum</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> Yes, the idx corresponds exactly to the index into <code>vtable_entries</code> slice.</p>



<a name="246858214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246858214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246858214">(Jul 22 2021 at 14:55)</a>:</h4>
<p>-</p>



<a name="246863297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246863297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexa VanHattum <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246863297">(Jul 22 2021 at 15:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span> great, thank you! And thanks for the extensive comments in your PR!</p>



<a name="246863412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/246863412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#246863412">(Jul 22 2021 at 15:32)</a>:</h4>
<p>np =)</p>



<a name="247129248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247129248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247129248">(Jul 25 2021 at 14:38)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> <span class="user-mention" data-user-id="120791">@RalfJ</span> Hello, i'm working on trait upcasting coercion's pointer cast handling. I'm a little unsure about what the best approach would be. Would you mind give me a few advices?</p>



<a name="247129298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247129298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247129298">(Jul 25 2021 at 14:40)</a>:</h4>
<p>Now i'm reading code related to <code>PointerCast::Unsize</code></p>



<a name="247129322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247129322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247129322">(Jul 25 2021 at 14:41)</a>:</h4>
<p>Its comment says this:</p>
<div class="codehilite"><pre><span></span><code>    /// Unsize a pointer/reference value, e.g., `&amp;[T; n]` to
    /// `&amp;[T]`. Note that the source could be a thin or fat pointer.
    /// This will do things like convert thin pointers to fat
    /// pointers, or convert structs containing thin pointers to
    /// structs containing fat pointers, or convert between fat
    /// pointers. We don&#39;t store the details of how the transform is
    /// done (in fact, we don&#39;t know that, because it might depend on
    /// the precise type parameters). We just store the target
    /// type. Codegen backends and miri figure out what has to be done
    /// based on the precise source/target type at hand.
</code></pre></div>



<a name="247129374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247129374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247129374">(Jul 25 2021 at 14:42)</a>:</h4>
<p>So basically it's asking this be implemented separatedly in each of codegen/miri .</p>



<a name="247132028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247132028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247132028">(Jul 25 2021 at 15:51)</a>:</h4>
<p>For cg_clif this would be changing <a href="https://github.com/bjorn3/rustc_codegen_cranelift/blob/356360836e128e1d1eb11caf6ff5186efb211960/src/unsize.rs#L28-L33">https://github.com/bjorn3/rustc_codegen_cranelift/blob/356360836e128e1d1eb11caf6ff5186efb211960/src/unsize.rs#L28-L33</a> For cg_ssa this would be changing <a href="https://github.com/rust-lang/rust/blob/6489ee10410f7be70dbefad322d1a3e1533ab282/compiler/rustc_codegen_ssa/src/base.rs#L144-L147">https://github.com/rust-lang/rust/blob/6489ee10410f7be70dbefad322d1a3e1533ab282/compiler/rustc_codegen_ssa/src/base.rs#L144-L147</a>. For miri this would be <a href="https://github.com/rust-lang/rust/blob/6489ee10410f7be70dbefad322d1a3e1533ab282/compiler/rustc_mir/src/interpret/cast.rs#L273-L277">https://github.com/rust-lang/rust/blob/6489ee10410f7be70dbefad322d1a3e1533ab282/compiler/rustc_mir/src/interpret/cast.rs#L273-L277</a></p>



<a name="247133959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247133959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247133959">(Jul 25 2021 at 16:43)</a>:</h4>
<p>oh funny, I did not know about this comment :D</p>



<a name="247134000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247134000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247134000">(Jul 25 2021 at 16:44)</a>:</h4>
<p>but yeah, new casts need to be implement in each codegen backend separately, and miri is like a codegen backend here</p>



<a name="247134015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247134015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247134015">(Jul 25 2021 at 16:44)</a>:</h4>
<p>to make sure I understand, this is about casting <code>&amp;dyn Trait1</code> to <code>&amp;dyn Trait2</code> when <code>Trait2</code> is a supertrait of <code>Trait1</code>?</p>



<a name="247134281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247134281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247134281">(Jul 25 2021 at 16:50)</a>:</h4>
<p>Yes, indeed!</p>



<a name="247134869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247134869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247134869">(Jul 25 2021 at 17:04)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span>   I believe for  <code>* dyn Trait1</code> to <code>*dyn Trait2</code> coercion, an unsafe block will be needed. I'm not yet sure how to implement this yet, nor am i very sure about the exact language rules should be...</p>



<a name="247134981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247134981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247134981">(Jul 25 2021 at 17:05)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I'll start with <code>cg_clif</code> then. it's 1am now here, so let me quickly scratch out a simple version... I think i've got a few questions to ask, basically about emitting code that reads memory.</p>



<a name="247135477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247135477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247135477">(Jul 25 2021 at 17:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/object.20upcasting/near/247134869">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span>   I believe for  <code>* dyn Trait1</code> to <code>*dyn Trait2</code> coercion, an unsafe block will be needed. I'm not yet sure how to implement this yet, nor am i very sure about the exact language rules should be...</p>
</blockquote>
<p>why that?<br>
how exactly is &amp;dyn Trait1 to &amp;dyn Trait2 implemented?</p>



<a name="247135487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247135487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247135487">(Jul 25 2021 at 17:17)</a>:</h4>
<p>but if you are unsure it is probably best to make it unsafe. the unsafety checker is here: <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir/src/transform/check_unsafety.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir/src/transform/check_unsafety.rs</a></p>



<a name="247135646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247135646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247135646">(Jul 25 2021 at 17:21)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span>  I haven't write it down yet, there're two code paths, for the simpler case, the original pointer scalar pair is not changed at all.<br>
For the second, more complex case, it will reach out to the vtable through the metadata scalar in the scalar pair, access its one slot at a fixed offset calculated out using <code>Trait1</code> and <code>Trait2</code> type info, and use that as the new metadata value.</p>



<a name="247135735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247135735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247135735">(Jul 25 2021 at 17:23)</a>:</h4>
<p>so for <code>&amp;dyn Trait1</code> this operation will always succeed. While for <code>*dyn Trait1</code> this has to depend on the initial validity of the pointer itself.</p>



<a name="247137292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247137292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247137292">(Jul 25 2021 at 18:01)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span>  I think this is almost the version for <code>cg_clif</code> ... modulo necessary type conversions. Is there something i need to pay extra attention to?</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">old_info</span><span class="w"> </span><span class="o">=</span><span class="w"></span>
<span class="w">                </span><span class="n">old_info</span><span class="p">.</span><span class="n">expect</span><span class="p">(</span><span class="s">"unsized_info: missing old info for trait upcasting coercion"</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="n">data_a</span><span class="p">.</span><span class="n">principal_def_id</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">data_b</span><span class="p">.</span><span class="n">principal_def_id</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">old_info</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="c1">// trait upcasting coercion</span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">principal_a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">data_a</span><span class="w"></span>
<span class="w">                    </span><span class="p">.</span><span class="n">principal</span><span class="p">()</span><span class="w"></span>
<span class="w">                    </span><span class="p">.</span><span class="n">expect</span><span class="p">(</span><span class="s">"unsized_info: missing principal trait for trait upcasting coercion"</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">principal_b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">data_b</span><span class="w"></span>
<span class="w">                    </span><span class="p">.</span><span class="n">principal</span><span class="p">()</span><span class="w"></span>
<span class="w">                    </span><span class="p">.</span><span class="n">expect</span><span class="p">(</span><span class="s">"unsized_info: missing principal trait for trait upcasting coercion"</span><span class="p">);</span><span class="w"></span>

<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">vptr_entry_idx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">fx</span><span class="p">.</span><span class="n">tcx</span><span class="p">.</span><span class="n">vtable_trait_upcasting_slot_idx</span><span class="p">(</span><span class="w"></span>
<span class="w">                    </span><span class="n">source</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="n">principal_a</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="n">principal_b</span><span class="p">.</span><span class="n">def_id</span><span class="p">(),</span><span class="w"></span>
<span class="w">                </span><span class="p">);</span><span class="w"></span>

<span class="w">                </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">entry_idx</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">vptr_entry_idx</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="kd">let</span><span class="w"> </span><span class="n">entry_offset</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">entry_idx</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">fx</span><span class="p">.</span><span class="n">pointer_type</span><span class="p">.</span><span class="n">bytes</span><span class="p">();</span><span class="w"></span>
<span class="w">                    </span><span class="kd">let</span><span class="w"> </span><span class="n">vptr_ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Pointer</span>::<span class="n">new</span><span class="p">(</span><span class="n">old_info</span><span class="p">).</span><span class="n">offset</span><span class="p">(</span><span class="n">entry_offset</span><span class="p">).</span><span class="n">load</span><span class="p">(</span><span class="w"></span>
<span class="w">                        </span><span class="n">fx</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">fx</span><span class="p">.</span><span class="n">pointer_type</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">MemFlags</span>::<span class="n">new</span><span class="p">(),</span><span class="w"></span>
<span class="w">                    </span><span class="p">);</span><span class="w"></span>
<span class="w">                    </span><span class="n">vptr_ptr</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">old_info</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="247137310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247137310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247137310">(Jul 25 2021 at 18:01)</a>:</h4>
<p>You can use <code>MemFlags::trusted()</code> instead of <code>MemFlags::new()</code>. That makes it UB for it to trap or be unaligned.</p>



<a name="247137359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247137359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247137359">(Jul 25 2021 at 18:02)</a>:</h4>
<p>ok</p>



<a name="247137361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247137361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247137361">(Jul 25 2021 at 18:02)</a>:</h4>
<p>Apart from that I think it looks fine.</p>



<a name="247137423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247137423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247137423">(Jul 25 2021 at 18:04)</a>:</h4>
<p>Thanks! 2am now. Need to get some sleep... I'll try to write the miri one tomorrow evening when i'm back from work =)</p>



<a name="247138099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247138099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247138099">(Jul 25 2021 at 18:21)</a>:</h4>
<blockquote>
<p>For the second, more complex case, it will reach out to the vtable through the metadata scalar in the scalar pair, access its one slot at a fixed offset calculated out using Trait1 and Trait2 type info, and use that as the new metadata value.</p>
</blockquote>
<p>okay, so basically vtables "link to" the vtables of supertraits, forming a kind of linked list? makes sense.</p>



<a name="247138143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247138143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247138143">(Jul 25 2021 at 18:22)</a>:</h4>
<p>this will be interesting input for the discussion around whether raw pointers have to have valid vtables</p>



<a name="247138146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247138146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247138146">(Jul 25 2021 at 18:22)</a>:</h4>
<p>so far we say yes they do but also want to remain future compaible with changing our mind -- so yeah that cast needs to be unsafe</p>



<a name="247291283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247291283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247291283">(Jul 27 2021 at 03:44)</a>:</h4>
<p>Progress updated: Implemented all three "unsized_info" functions. But seems needs more change, for example, llvm version:<br>
<a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/base.rs#L221">https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/base.rs#L221</a></p>



<a name="247291364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247291364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247291364">(Jul 27 2021 at 03:46)</a>:</h4>
<p>I'm thinking about expanding the duty of "unsize_thin_ptr"...</p>



<a name="247291512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247291512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247291512">(Jul 27 2021 at 03:50)</a>:</h4>
<p>But i'm a little confused about <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/mir/rvalue.rs#L221">https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/mir/rvalue.rs#L221</a><br>
which seems to be another duplication ...</p>



<a name="247291956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247291956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247291956">(Jul 27 2021 at 04:01)</a>:</h4>
<p>Is it ok to unify <code>unsize_thin_ptr</code> into <code>unsize_ptr</code> which supports both thin and fat source ptr?  cc <span class="user-mention" data-user-id="119009">@eddyb</span> <span class="user-mention" data-user-id="133247">@bjorn3</span></p>



<a name="247298473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247298473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247298473">(Jul 27 2021 at 06:28)</a>:</h4>
<p>I think that would be fine. cg_clif needs the same change I think.</p>



<a name="247610804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247610804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247610804">(Jul 29 2021 at 16:58)</a>:</h4>
<p>office hour slot in 1hr :)  let's continue to use this topic to discuss <a href="https://github.com/rust-lang/rust/issues/86264">#86264</a></p>



<a name="247610815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247610815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247610815">(Jul 29 2021 at 16:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="247619734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619734">(Jul 29 2021 at 18:03)</a>:</h4>
<p>wave</p>



<a name="247619779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619779">(Jul 29 2021 at 18:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span></p>



<a name="247619781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619781">(Jul 29 2021 at 18:03)</a>:</h4>
<p>hi~</p>



<a name="247619904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619904">(Jul 29 2021 at 18:04)</a>:</h4>
<p>I'm skimming PR but</p>



<a name="247619905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619905">(Jul 29 2021 at 18:04)</a>:</h4>
<p>So today we'll move on to the trait-system related part of trait upcasting coercion work.</p>



<a name="247619916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619916">(Jul 29 2021 at 18:04)</a>:</h4>
<p>did you have specific questions you wanted to discuss</p>



<a name="247619933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619933">(Jul 29 2021 at 18:04)</a>:</h4>
<p>Yes!</p>



<a name="247619974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247619974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247619974">(Jul 29 2021 at 18:05)</a>:</h4>
<p>For this time, i think maybe we'll have one decision to made....</p>



<a name="247620005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620005">(Jul 29 2021 at 18:05)</a>:</h4>
<p>It's about <code>* dyn Trait</code> raw pointer upcasting</p>



<a name="247620026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620026">(Jul 29 2021 at 18:05)</a>:</h4>
<p>ok</p>



<a name="247620085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620085">(Jul 29 2021 at 18:06)</a>:</h4>
<p>i think we'll choose between 1. make it an unsafe operation 2. make it impossible to <code>Unsize</code></p>



<a name="247620107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620107">(Jul 29 2021 at 18:06)</a>:</h4>
<p>I saw some earlier discussion</p>



<a name="247620130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620130">(Jul 29 2021 at 18:06)</a>:</h4>
<p>the key point is that we haven't yet decided whether a <code>*dyn Trait</code> is required to have a valid vtable?</p>



<a name="247620137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620137">(Jul 29 2021 at 18:06)</a>:</h4>
<p>I think that making it unsafe is a reasoable idea</p>



<a name="247620140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620140">(Jul 29 2021 at 18:06)</a>:</h4>
<p>Yes, indeed!</p>



<a name="247620160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620160">(Jul 29 2021 at 18:06)</a>:</h4>
<p>I'm not sure what the connection is to <code>Unsize</code> though</p>



<a name="247620224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620224">(Jul 29 2021 at 18:07)</a>:</h4>
<p>can you elaborate on that?</p>



<a name="247620238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620238">(Jul 29 2021 at 18:07)</a>:</h4>
<p>that trait is a bit out of cache for me</p>



<a name="247620327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620327">(Jul 29 2021 at 18:08)</a>:</h4>
<p>It's a symbolic representation of all unsizing impl. Through the real implementations may not exist.</p>



<a name="247620439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620439">(Jul 29 2021 at 18:08)</a>:</h4>
<p>I don't follow that either :)</p>



<a name="247620482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620482">(Jul 29 2021 at 18:09)</a>:</h4>
<p>in particular it sounded like you were saying that <em>if</em> we make it unsafe to upcast a <code>*dyn Foo</code></p>



<a name="247620492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620492">(Jul 29 2021 at 18:09)</a>:</h4>
<p>then it is possible to <code>Unsize</code>?</p>



<a name="247620498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620498">(Jul 29 2021 at 18:09)</a>:</h4>
<p>(but otherwise, it is not?)</p>



<a name="247620529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620529">(Jul 29 2021 at 18:09)</a>:</h4>
<p>I think so, but i may have got it wrong ...</p>



<a name="247620644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620644">(Jul 29 2021 at 18:10)</a>:</h4>
<p>can you say a bit more about the connection between those two</p>



<a name="247620674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620674">(Jul 29 2021 at 18:10)</a>:</h4>
<p>reading over your PR, the main thing I am a bit uncomfortable with is the way that we walk through the supertraits list, I'm tying to decide how we should know where to stop</p>



<a name="247620689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620689">(Jul 29 2021 at 18:11)</a>:</h4>
<p>just checking if the trait def-ids match doesn't seem right</p>



<a name="247620702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620702">(Jul 29 2021 at 18:11)</a>:</h4>
<p>I know that earlier you had <code>==</code> and I complained about that, too</p>



<a name="247620719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620719">(Jul 29 2021 at 18:11)</a>:</h4>
<p>I'm imagining a case like <code>trait Foo: Bar&lt;u32&gt; + Bar&lt;i32&gt;</code></p>



<a name="247620759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620759">(Jul 29 2021 at 18:11)</a>:</h4>
<p>Oh!</p>



<a name="247620911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247620911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247620911">(Jul 29 2021 at 18:13)</a>:</h4>
<p>I'm looking to see what fns exist</p>



<a name="247621100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621100">(Jul 29 2021 at 18:14)</a>:</h4>
<p>Yes, i think i'll need some mentoring here.</p>



<a name="247621124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621124">(Jul 29 2021 at 18:14)</a>:</h4>
<p>I'm thinking about it</p>



<a name="247621150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621150">(Jul 29 2021 at 18:15)</a>:</h4>
<p>we might have a type with inference variables where it's actually ambiguous</p>



<a name="247621181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621181">(Jul 29 2021 at 18:15)</a>:</h4>
<p>e.g. <code>Box&lt;dyn Bar&lt;_&gt;&gt;</code></p>



<a name="247621191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621191">(Jul 29 2021 at 18:15)</a>:</h4>
<p>er</p>



<a name="247621196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621196">(Jul 29 2021 at 18:15)</a>:</h4>
<p>I guess it's more about the target type</p>



<a name="247621214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621214">(Jul 29 2021 at 18:15)</a>:</h4>
<p><code>Box&lt;dyn Foo&gt; as Box&lt;dyn Bar&lt;_&gt;&gt;</code></p>



<a name="247621326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621326">(Jul 29 2021 at 18:16)</a>:</h4>
<p>we probably want something like the "can unify" test</p>



<a name="247621385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621385">(Jul 29 2021 at 18:17)</a>:</h4>
<p>though I don't love that</p>



<a name="247621401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621401">(Jul 29 2021 at 18:17)</a>:</h4>
<p>anyway, let's leave it for now, I'll leave a review</p>



<a name="247621426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621426">(Jul 29 2021 at 18:17)</a>:</h4>
<p>I'll have to dig into it a bit</p>



<a name="247621442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621442">(Jul 29 2021 at 18:17)</a>:</h4>
<p>regarding safety, I think that the upcast should be unsafe</p>



<a name="247621475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621475">(Jul 29 2021 at 18:18)</a>:</h4>
<p>for raw pointers, yes</p>



<a name="247621604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621604">(Jul 29 2021 at 18:19)</a>:</h4>
<p>I haven't read the unsafety checking code in the compiler yet. I'll dig into it next week or so. I want to put off the unsafety checking part into next PR.</p>



<a name="247621817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621817">(Jul 29 2021 at 18:21)</a>:</h4>
<p>that sounds reasonable</p>



<a name="247621829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621829">(Jul 29 2021 at 18:21)</a>:</h4>
<p>is there a tracking issue for this where we can note it so it's not forgotten, though?</p>



<a name="247621924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621924">(Jul 29 2021 at 18:22)</a>:</h4>
<p>Yes, i've wrote it in the tracking issue: <a href="https://github.com/rust-lang/rust/issues/65991">#65991</a></p>



<a name="247621938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621938">(Jul 29 2021 at 18:22)</a>:</h4>
<p>In the implementation history part</p>



<a name="247621999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247621999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247621999">(Jul 29 2021 at 18:22)</a>:</h4>
<p>ok, good</p>



<a name="247622089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622089">(Jul 29 2021 at 18:23)</a>:</h4>
<p>cool. I've got some time tomorrow that I hope to use for reviewing</p>



<a name="247622180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622180">(Jul 29 2021 at 18:24)</a>:</h4>
<p>so I'll look at the question of how to pick from the list then <em>but</em></p>



<a name="247622191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622191">(Jul 29 2021 at 18:24)</a>:</h4>
<p>one thing we might do that's very, very simple :P</p>



<a name="247622228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622228">(Jul 29 2021 at 18:24)</a>:</h4>
<p>only allow the upcast if the trait appears exactly once for now</p>



<a name="247622256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622256">(Jul 29 2021 at 18:24)</a>:</h4>
<p>sounds good, i'll update the pr</p>



<a name="247622269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622269">(Jul 29 2021 at 18:24)</a>:</h4>
<p>not really what we want but it won't do the wrong thing</p>



<a name="247622285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622285">(Jul 29 2021 at 18:25)</a>:</h4>
<p>if you do that, we should add another bullet to address it in a better way later</p>



<a name="247622298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622298">(Jul 29 2021 at 18:25)</a>:</h4>
<p>I think ti'd be good though to kcik this can down the road a bit</p>



<a name="247622319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622319">(Jul 29 2021 at 18:25)</a>:</h4>
<p>i wonder if it is possible to make the above case into "multiple candidates", so each get confirmed separately</p>



<a name="247622333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622333">(Jul 29 2021 at 18:25)</a>:</h4>
<p>though i don't really know how to do that... for now</p>



<a name="247622344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622344">(Jul 29 2021 at 18:25)</a>:</h4>
<p>interesting thought</p>



<a name="247622381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622381">(Jul 29 2021 at 18:26)</a>:</h4>
<p>I have to review the code a bit</p>



<a name="247622426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622426">(Jul 29 2021 at 18:26)</a>:</h4>
<p>that might make sense</p>



<a name="247622468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622468">(Jul 29 2021 at 18:26)</a>:</h4>
<p>anyway, i'll use the simple strategy for now. i'll update the pr and the tracking issue.</p>



<a name="247622808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622808">(Jul 29 2021 at 18:29)</a>:</h4>
<p>thanks <span class="user-mention" data-user-id="116458">@Charles Lew</span> !</p>



<a name="247622830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247622830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247622830">(Jul 29 2021 at 18:29)</a>:</h4>
<p>thank you for your time !</p>



<a name="247629630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247629630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247629630">(Jul 29 2021 at 19:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  PR and tracking issue updated following your advice here!</p>



<a name="247703067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247703067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247703067">(Jul 30 2021 at 12:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span> I read the PR -- it looks good. I'm thinking that it would be nice to come up with a "canonical set of tests" for some of the corner cases.</p>



<a name="247703537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247703537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247703537">(Jul 30 2021 at 12:54)</a>:</h4>
<p>Yes, at least i plan to include those tests introduced by @alexreg in <a href="https://github.com/rust-lang/rust/pull/60900/commits/9549fbd6255fb9f7e4ce1a8859fae7335465e014">https://github.com/rust-lang/rust/pull/60900/commits/9549fbd6255fb9f7e4ce1a8859fae7335465e014</a></p>



<a name="247703594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247703594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247703594">(Jul 30 2021 at 12:54)</a>:</h4>
<p>Most of those are <code>run-pass</code> though... So they can't pass without the codegen changes.</p>



<a name="247704051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704051">(Jul 30 2021 at 12:59)</a>:</h4>
<p>Should i include them as <code>check-pass</code> tests in the first pr?</p>



<a name="247704529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704529">(Jul 30 2021 at 13:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="247704565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704565">(Jul 30 2021 at 13:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span> I added a coment with  a hackmd of tests to add</p>



<a name="247704583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704583">(Jul 30 2021 at 13:03)</a>:</h4>
<p>and delegated r+ to you, on the assumption they behave as I expected :)</p>



<a name="247704609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704609">(Jul 30 2021 at 13:03)</a>:</h4>
<p>they are poking at the interactions of type/region checking</p>



<a name="247704625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704625">(Jul 30 2021 at 13:03)</a>:</h4>
<p>ok, thanks!</p>



<a name="247704635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704635">(Jul 30 2021 at 13:03)</a>:</h4>
<p><a href="https://hackmd.io/_CDoRWIZRbuZ8qgN4luouA">the hackmd</a></p>



<a name="247704973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247704973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247704973">(Jul 30 2021 at 13:06)</a>:</h4>
<p>For the "// OK, eventually" cases, i should make them into FIXMEs in this first pr, is this correct?</p>



<a name="247705859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247705859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247705859">(Jul 30 2021 at 13:14)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span> yep</p>



<a name="247712815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247712815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247712815">(Jul 30 2021 at 14:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Hello, there's one test that's failing from the hackmd. After reading it, i wonder if this really should be ambiguous error or not:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">Foo</span>: <span class="nc">Bar</span><span class="o">&lt;</span><span class="kt">i32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">trait</span><span class="w"> </span><span class="n">Bar</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Option</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nb">None</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">test_infer_arg</span><span class="p">(</span><span class="n">x</span>: <span class="kp">&amp;</span><span class="nc">dyn</span><span class="w"> </span><span class="n">Foo</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="o">&amp;</span><span class="k">dyn</span><span class="w"> </span><span class="n">Bar</span><span class="o">&lt;</span><span class="n">_</span><span class="o">&gt;</span><span class="p">;</span><span class="w"> </span><span class="c1">// Ambiguous</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">a</span><span class="p">.</span><span class="n">bar</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="247713653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247713653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247713653">(Jul 30 2021 at 14:15)</a>:</h4>
<p>this is in the second test group within the hackmd.</p>



<a name="247734716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247734716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247734716">(Jul 30 2021 at 16:57)</a>:</h4>
<p>After some thinking, i changed the definition of <code>Foo</code> to:<br>
<code>trait Foo&lt;T&gt;: Bar&lt;i32&gt; + Bar&lt;T&gt; {}</code></p>
<p>Now this test group looks like this:<br>
<a href="https://github.com/rust-lang/rust/blob/d60ae35deaaee047ef186c6538bf06f198cb7cbe/src/test/ui/traits/trait-upcasting/type-checking-test-2.rs">https://github.com/rust-lang/rust/blob/d60ae35deaaee047ef186c6538bf06f198cb7cbe/src/test/ui/traits/trait-upcasting/type-checking-test-2.rs</a></p>
<p>I hope this matches your original idea :)</p>



<a name="247809603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/object%20upcasting/near/247809603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/object.20upcasting.html#247809603">(Jul 31 2021 at 15:33)</a>:</h4>
<p>Hooray, <a href="https://github.com/rust-lang/rust/issues/86264">#86264</a> has landed and we can continue with <a href="https://github.com/rust-lang/rust/issues/87515">#87515</a> now. I've updated the PR and addressed the previous comments. Please give it another look when you've got time. Thanks!  <span class="user-mention" data-user-id="133247">@bjorn3</span> <span class="user-mention" data-user-id="120791">@RalfJ</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>